...
/Refactoring to Set Initial State from the Reducer
Refactoring to Set Initial State from the Reducer
In Redux, the initial state of an app should be returned to us by the reducer. Let's see how we can apply this rule on Skypey to return 'contacts' in the initial state.
We'll cover the following...
Firstly, please have a look at the creation of the store in store/index.js. In particular, consider this line of code:
const store = createStore(reducer, { contacts });
The initial state object is passed directly into createStore. Remember that the store is created with the signature, createStore(reducer,
...