update
found a simple solution in the antd TreeNode component. generates a tree directly from the data . The only thing to consider is the data structure, not the problem of recursion.
you need to render a menu in the form of a tree graph based on an indefinite level of data.
the data structure is as follows:
[{"checked":null,"id":1,"name":"","pId":0},{"checked":null,"id":2,"name":"","pId":3,},{"checked":null,"id":3,"name":"","pId":4},{"checked":null,"id":4,"name":"","pId":5},{"checked":null,"id":5,"name":"","pId":6}]
component is how Antd TreeMenu, is used:
<TreeNode title={} key={}>
<TreeNode title={} key={}>
</TreeNode
</TreeNode>
try to solve the problem through recursion . Although I understand the concept, I just don"t have a train of thought. I hope to get an answer!