Closed bnsv-mayank closed 6 years ago
What kind of prop are you changing? If the prop that is changing is an object, then you'll have to make sure you're passing a "new" object. The component will not update if the reference of the prop is the same.
Hey, I'm changing the tree (which is an array). Basically, I have an object: BigTree which contains 4 arrays: smallTree1..smallTree4. I'm passing BigTree[smallTree(x)] where x is decided by user. Could you explain why this is not re-rendering the component? This information goes inside "tree" prop. I'm not using any other props.
I will try to look into this tonight or tomorrow. I will get back to you soon :)
Thanks. I have tried a lot of things and nothing seems to work. It does re-render but only when an array with string is passed to tree. If I pass an array of objects, the problem comes back.
Good to know, will help me debug this faster :)
I'll be waiting. My code heavily depends on your library so I hope it gets fixed.
Fixed in v2.0.1
🎉
Hey, it works! I have a question tho. Can we add any other property in the objects present in the tree array? I mean that we are allowed value and nodes, so is it possible to add our own defined attribute?
Hm, what are you trying to do?
Basically, I want to pass a icon to the value prop in tree. However, it seems like value can only accept strings. Is there any work around?
Ah, there's currently no way. We should probably add a new field icon
in a tree node. I created https://github.com/helfi92/material-ui-treeview/issues/20. Feel free to take it if you want to give it a shot.
I used this component to get a tree view for all of my data. However, when the props are updated, it seems like the component is not re-rendering and hence the page is not updated. I can confirm that the props passed are being updated because I'm printing them.