Merging all reducers together

OK, so we now have a reducer for handling our list of jedis as well as a reducer dedicated to handling selections of a specific jedis. We mentioned before that, in Redux, we have a single store where all our data lives. Now it's time to create that single store. This can be easily accomplished by creating the following function store():

// core-concepts/merged-reducers.jsfunction store(state = { jedis: [], selectedJedi: null }, action) {  return {    jedis: jediListReducer(state.jedis, action),    selectedJedi: selectJediReducer(state.selectedJedi, action)  };}let newJediActionYoda = { type: "ADD_ITEM", payload: { name: "Yoda"} };let newJediActionVader = { type: "ADD_ITEM", payload: { name: "Vader"} };let newJediSelection ...

Get Architecting Angular Applications with Redux, RxJS, and NgRx now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.