concept component tree in category react

appears as: component tree
React Hooks in Action

This is an excerpt from Manning's book React Hooks in Action.

So how does Concurrent Mode enable this magic? The new React architecture breaks its tasks into smaller units of work, providing regular points for the browser or operating system to inform the application that a user is trying to interact with it. React’s scheduler can then decide what jobs to do based on the priority of each. Reconciling and committing changes to one part of the component tree can be paused or abandoned to make sure components with higher priority are updated first.

With the bookable details off on their own adventures and the reducer lifted up to the parent, the changes to the BookablesList component mostly took the form of deletions. One key addition was the inclusion of dispatch in the dependency array for the data-loading effect. Housing the state in the BookablesView component (or maybe even higher up the component tree) seems easy. Stick all the data there and pass a dispatch function to any descendant components that need to make changes to the state. It’s a valid approach, and one used by popular state-store libraries like Redux. But before throwing all the state up to the top of the app, even if most components don’t care about most of the state that ends up there, let’s investigate an alternative.