The first order of business is to have a look at our first view and how it reacts to user interactions. It looks like this currently:
// first.view.jsimport dispatcher from "./dispatcher";class FirstView { selectIndex(index) { dispatcher.dispatch({ type: "SELECT_INDEX", data: index }); }}let view = new FirstView();
Adding a few more actions into the mix means we would extend the view with a few methods like this:
// first.viewII.jsimport dispatcher from "./dispatcher";class View { selectIndex(data) { dispatcher.dispatch({ type: "SELECT_INDEX", data }); } createProduct(data) { dispatcher.dispatch({ type: "CREATE_PRODUCT", data }); } removeProduct(data) { dispatcher.dispatch({ type: "REMOVE_PRODUCT", data }); }}let view ...