C
C
chelkaz2018-10-30 10:50:31
React
chelkaz, 2018-10-30 10:50:31

Where is the error in the small React component. Why doesn't it work like in the example?

I just had to implement prepared components on React from ant.design
There is a Tree list with the search "Searchable Tree"
I created my own tree: The component seems to be searching, but why is it collapsed? In the original example, the tree is generated, but it works there.
Here is my output:
https://codepen.io/anon/pen/QZRGjM

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-10-30
@chelkaz

Everything works as it should. It's just that, unlike the example from the documentation, the values ​​of the key and title fields are different, so when you search, you check the wrong values ​​that you display. Replace in the generateList method with
dataList.push({ key, title: key });
dataList.push({ key, title: node.title });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question