We have so far learned how to set up NgRx by importing and registering its module. We have also been taught about the select() function that gives us a slice of state, and the dispatch() function that allows us to dispatch an action. These are the basics, we will use these very same basics and create a new reducer to reinforce what we already know, while introducing the concept payload.
We need to do the following:
- Tell the store we have a new state, jedis
- Create a jediListReducer and register it with the store
- Create a component that supports showing our jediList, but is also able to dispatch actions that will change our slice of state jedis
Let's get down to business by defining our reducer, jediListReducer ...