Somehow, the list view needs to listen to changes in the store so that it can rerender when a change happens. A way to do that is, of course, to set up some kind of listener that triggers an event when a change happens. If we, as a view, subscribe to such changes, then we can act accordingly and rerender our view. There are different ways of accomplishing this: we can either just implement an Observable pattern or use a library, such as EventEmitter. Let's update our redux.js file to make it so:
// dataflow/redux.jsimport { itemsReducer } from "./reducer";import EventEmitter from "events";const emitter = new EventEmitter();let state = { items: []};function store(state = { items: [] }, action) { ...