-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Micro State Management with React Hooks
By :

React is designed around the concept of components. In the component model, everything is expected to be reusable. Global state is something that exists outside of components. It's often true that we should avoid using a global state where possible because it requires an extra dependency on a component. However, a global state is sometimes very handy and allows us to be more productive. For some app requirements, global state fits well.
There are two challenges when designing a global state:
Global state tends to have multiple values. It's often the case that a component using a global state doesn't need all the values in it. If a component re-renders when a global state is changed but the changed values are not relevant to the component, it's an extra re-render. Extra re-renders are not desirable, and global state libraries should provide a solution...