Using the data-centric and component-centric approaches
Global state can technically be divided into two types: data-centric and component-centric.
In the following sections, we will discuss both these approaches in detail. Then, we will also talk about some exceptions.
Understanding the data-centric approach
When you design an app, you may have a data model as a singleton in your app and you may already have the data to deal with. In this case, you would define components and connect the data and the components. The data can be changed from the outside, such as by other libraries or from other servers.
For the data-centric approach, module state would fit better, because module state resides in JavaScript memory outside React. Module state can exist before React starts rendering or even after all React components are unmounted.
Global state libraries using the data-centric approach would provide APIs to create module state and to connect the module state to React components...