Split your Redux Store into Multiple Reducers

Share this video with your friends

Send Tweet

As we start to put more data and logic into redux.

One of the first thing that happens is that we break out our root reducer into multiple reducers, sometimes called slices, which are meant to represent “slices” of data in your application.

To achieve this we rely on the combineReducers method from redux.

Once we split up out reducers, I then show how to access the state using the namespaces we just created and share some best practices for naming actions.

Note

The redux style guide suggests modeling actions as events and not setters. For example rates/ratesReceived instead of rates/setRates. This encourages the pattern of listening for actions across multiple reducers.