Running the demo

Before we can run our demo we need an application file, app.js. The app.js file should require in our views and also carry out the selection:

// demo/app.jsimport selectionView from './selectionView';import selectedView from './selectedView';// carry out the selectionselectionView.selectIndex(1);

To run our demo we need to compile it. Above we are using ES2015 modules. To compile those we will use webpack. We need to install webpack by typing the following in our terminal:

npm install webpack webpack-cli --save-dev

Once we have done so we need to create webpack.config.js file where we tell Webpack how to compile our files and where to place the resulting bundle. That file looks like the following:

// webpack.config.jsmodule.exports ...

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.