react-arborist
react-arborist copied to clipboard
Create hook to react to all tree changes
trafficstars
I'd love to see a single hook to react to all tree changes.
Use case - I want the tree to handle add move delete rename internally, because quite frankly it's a PITA to manage, and a single hook where I can get the latest tree back. I'm store the entire tree as a single json document and it'd be far easier to just upsert the tree.
Update - I ended up just implementing all of the handler functions and it's working well, I saw the 'effect' of what I wanted was capable if I used a simpleTree.. but I quickly outgrew that.
(i.e.,
const {treeItems, controller} = useSimpleTree(initialData);
It would still be nice to to expose a hook "onPresenceChange" or something that callers could react to