Reducer Composition Revisited
Explore how reducer composition works in Redux through the combineReducers utility. Learn to structure state management by combining multiple reducers, ensuring each reducer manages its state slice. Understand the distinction between individual reducer returns and the overall application state, aiding in building efficient user components.
We'll cover the following...
Let me take a step back and explain how reducer composition works again. This time, from a different perspective.
Consider the javascript object below:
Now, assume that instead of having the values of the keys hardcoded, we wanted it to be represented by function calls. That may look like this:
This assumes that getUser() will also return the previous value, “me”. The same goes for the other replaced functions.
Still following?
Now, ...