We have yet to create the dispatch() method, so we will do that next:
// dataflow/redux.jsexport function dispatch(action) { // implement this}
What we can see from the preceding code is that we have a dispatch() function, which is one of the things we export from this file. Let's try to fill in the implementation:
// dataflow/redux-stepI.js// 1)function itemsReducer(state = [], action) { switch(action.type) { case "CREATE_ITEM": return [...state, Object.assign(action.payload) ]; default: return state; } }// 2)let state = { items: []};// 3function store(state = { items: [] }, action) { return { items: itemsReducer(state.items, action) };}// 4)export function getState() { return state;}// 5)export function ...