You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there! First let me know if this is not the right place for discussions like this, I'm happy to move it elsewhere if so :)
Recently I've been working with a large Tree and with treeData I can think about two main ways of structuring it: 1. A memoized object derived from your tree dependencies; or 2. A Tree state / reducer with the triggers to update it (main case in docs). The problem I see/I'm facing with it is that it translates into a linear structure (coming from React / how hooks work), being transformed into a Tree:
functionComponent(){constfirstLevelData=useGetFirstLevelData();// even more of a problem when these are asyncconstsecondLevelData=useGetSecondLevelData();// + any other dep to build the treeconsttreeData=/* build tree, with everything needed inside this component */;return<TreetreeData={treeData}/>;}
This got me thinking: the DOM itself is a Tree, so having it performant and with good ways to abstract it is part of the problem React had to solve, which makes React nodes potentially the best way of solving this:
functionSecondLevelNode(){constthirdLevelData=useGetThirdLevelData();return<TreeNode/>;// + any other Node component, can even be <LoadingNode /> when async for example}functionFirstLevelNode(){constsecondLevelData=useGetSecondLevelData();return<TreeNode>{secondLevelData.map(()=><SecondLevelNode/>)}</TreeNode>}functionComponent(){constfirstLevelData=useGetFirstLevelData();return<Tree>{firstLevelData.map(()=><FirstLevelNode/>)}</Tree>}
warning(false,'`children` of Tree is deprecated. Please use `treeData` instead.');
for the children prop (also it's not used in any example), which was added with #261. However virtualization seemed to still work when using it. So I'm wondering:
Is there any limitation/issue for it to be deprecated?
Does it make sense to keep supporting it for better structuring Trees with different dependencies for each level?
Thanks!!
The text was updated successfully, but these errors were encountered:
Hey there! First let me know if this is not the right place for discussions like this, I'm happy to move it elsewhere if so :)
Recently I've been working with a large Tree and with
treeData
I can think about two main ways of structuring it: 1. A memoized object derived from your tree dependencies; or 2. A Tree state / reducer with the triggers to update it (main case in docs). The problem I see/I'm facing with it is that it translates into a linear structure (coming from React / how hooks work), being transformed into a Tree:This got me thinking: the DOM itself is a Tree, so having it performant and with good ways to abstract it is part of the problem React had to solve, which makes React nodes potentially the best way of solving this:
I know there's a deprecation note in
tree/src/Tree.tsx
Line 367 in 7dbaebb
children
prop (also it's not used in any example), which was added with #261. However virtualization seemed to still work when using it. So I'm wondering:Thanks!!
The text was updated successfully, but these errors were encountered: