Closed psorensen closed 2 years ago
I'm looking for this feature as well
@yokeshwar93 I found this can be accomplished using useEffect(). Be sure to pass an empty array as the second parameter to prevent infinite updates.
<Tree nodes={[...]}>
{(controls) => {
useEffect(() => {
if ( postParent ) { // grabbing post parent from URL query params
controls.toggleNodeSelection(parseInt(postParent))
controls.toggleOpenCloseNode(parseInt(postParent))
}
}, []);
}}
</Tree>
@psorensen , I tried your work around and get this error: React Hook "useEffect" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function. I am using react and react-dom version 16.13.0. Do I need to upgrade react?
Hello, and thanks for the awesome component!
Is it possible to open a specific node on initialization? This would be particularly helpful for direct linking to folder states. Thanks!