Replies: 3 comments
-
I recommend using the discussions section rather than creating a new issue each time you have a question: https://github.com/dowjones/react-dropdown-tree-select/discussions I'm not following what your question is. Why can't you modify your structure to match what this library expects? Just traverse through your nodes and add a |
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply, If the data structure of this part can also be used in other places, and the key can be customized, it seems that the scalability will be better. The function of the key is the same, but the name of the key is not the same. Of course, this is just my suggestion, because I did see similar implementation, thank you again ~ |
Beta Was this translation helpful? Give feedback.
-
@yxd94772 I haven't had any requests for such mapping which makes me think yours is more of a special case. One of the principles I try to adhere to is KISS principle. Adding a such a capability will add complexity to the code, will require tests to ensure regression and will serve a very niche use case - not a good return on investment. Like @gandhis1 said, it is fairly trivial to layer an HOC that does the data mapping for you and that way keeps the component bare minimum. |
Beta Was this translation helpful? Give feedback.
-
The document provides the structure key needed for the data , Is there a property that can customize the key in data
const data = {
label: 'search me',
value: 'searchme',
cd: [
{
label: 'search me too',
value: 'searchmetoo',
cd: [
{
label: 'No one can get me',
value: 'anonymous',
},
],
},
],
}
So if my structure is like this, how can I match 'cd' to 'children'
Look forward to your reply , thanks XD
Beta Was this translation helpful? Give feedback.
All reactions