Reducers
This chapter covers the basic setup for Dynamic Reducer Injection.
Please note that reducers are not removed from Store when Component is unmounted.
Global Reducer Setup
First, we need to create a function that will allow us to inject new reducers dynamically.
In this example, the counter
reducer will be available on every page.
Store Configuration
After that, we need to enhance the store with applyAsyncReducers.
It needs the reducerCreator
to replace the old reducer with an updated one when we inject new reducers dynamically.
Dynamic Reducer Injection inside the Components
Now we can start injecting reducers dynamically, the reducer for TaskList
component will be loaded along with React Component.
Last updated