3 ms·
How is React state not a DAG out of the box? What problems does this solve? The pitch appears to be: > any outside change (user action, api result) unleashes a
by kokanee 3y ago
How is React state not a DAG out of the box? What problems does this solve? The pitch appears to be:
> any outside change (user action, api result) unleashes a graph traversal. Our UI components become much simpler, because they just need to dumbly reflect values in the graph.
But that sounds the same as the reasoning behind React's one-way data flow.
- bbsimonbb 3y agoIt's very different. Your react components are organized in a tree that mirrors your DOM. If you're using React without an additional state management package, you need to hoist your shared state to a common ancestor, then prop drill it down to where it's needed. Nightmare. I'm advocating a graph that mirrors your subject domain, unconstricted by your DOM. Also, my graph is constructed from below, which feels very intuitive. Nodes specify who they want to read. You make no change to the node being read.