Node know whether it has child or not
heyharii opened this issue · comments
Hi, Thank you for your great headless component
I was just wondering if you don't mind to return hasChild
also in the render params :)
So every node knew whether it has child or not :)
Need it to hide or show chevron :)
Thanks,
Hari
@udahari Thanks for your message!
I decided that there is no downside to adding the hasChild property.
I've committed it so that you can use the hasChild property as follows
<Tree
{... .props}
render={(node, {depth, isOpen, hasChild, onToggle}) => (
<div style={{marginLeft: depth * 10}}
// Do something
</div
)}
/>
It's already merged, so I'll make it available in the v1.2.0 publish.
I have just published v1.2.0.
If you update your npm package, you should now be able to use hasChild.
Thank you @minop1205