Tree structures #992
Replies: 2 comments
-
+1 I am also interested in knowing how one would approach with large tree-like payload from server. |
Beta Was this translation helpful? Give feedback.
-
Answer A: Answer B: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I haven't tried using this library yet, but am considering trying it out. We currently use Redux and it's common that we mirror server state in our global state, so this library is worthy of consideration to make things easier.
We often fetch tree structures from our server and persist in redux by flattening out the structure, then construct as a tree again on injecting via mapStateToProps into components. The flattened structure makes it easy to update any node in the tree in isolation in an immutable way.
We also deserialise all back-end structures into type-safe front-end structures (we use Typescript and declare models using interfaces).
If we moved to React Query:
a) Are there any known pitfalls in deserialising back-end json tree structures into typed tree structures via React Query? I haven't seen any deserialisation in the examples even for array data, let alone tree data.
b) Do the mutation controls of React Query make it easy to update nodes in isolation anywhere in the tree? Would be good to see an example.
Beta Was this translation helpful? Give feedback.
All reactions