Reducers specify how the feature state changes in response to actions sent to the store. A reducer function typically looks like this:
Before we can update state by dispatching actions, we need to add the reducer to the store. There are 2 options to register a feature reducer:
Like this the reducers are ready when the store is initialized.
We can add feature reducers at any time with
Now we are all set for updating the todos feature state.
Let's dispatch the
Yes, we did it! The todoReducer processed the action, and the new todo landed in the