How does Rematch work?
Internally, Rematch is pretty simple. That's why calling it a framework isn't quite correct; it's just a higher layer without the Redux boilerplate.
Let's analyze Rematch in depth. In Figure 2.4, we introduce the Rematch model:
Rematch models are among the most important parts of your store because they allow you to define the initial state of the model, the reducers, and the effects.
Any model is built on the basis of these properties:
Name
Models can contain a name that will become a key in the Redux store – this means that you will be able to access the state of a model or dispatch actions from a model using its name. Now, a name is not mandatory – if you don't provide a name, Rematch will use the object keys provided to the init()
function instead.
The init()
function returns a Rematch store, which is essentially a Redux store with...