const json = [
{
"id": 153612,
"children": [
{
"id": 198291,
"children": [
{
"id": 225027,
"children": [],
}
]
}
]
}
];
findNodeById(id, arr) {
const { dataSource } = this.props;
const loop = (arr) => {
if (arr.length === 0) {
return;
}
arr.forEach(v => {
if (v.id === id) {
return v.children;
}
loop(v.children);
});
};
loop(arr);
}
var r = findNodeById(198291, json);