Our aim is to learn how to set up Immutable JS. We will use the create-react-app
(https://github.com/facebook/create-react-app) configuration. Go ahead and download the starter code from GitHub, CH04
. Remove everything inside of the src
folder, or copy it to some other place for future reference.
So, what is inside the template files? There are simply some base dependencies and a configuration of Webpack, so that we can use ES6 syntax and CSS. You already learned how to configure Redux in Chapter 1, Understanding Redux, and other libraries in Chapter 2, Testing, and Chapter 3, Routing. Adding Immutable JS is not rocket science; it can be done as follows:
yarn add immutable --exact OR npm install immutable
Immutable JS (https://facebook.github.io/immutable-js/) comes with a bunch of data types that we can use. Most of the time, you will end up using Map
, List
, fromJS
, and Set
. We encourage you to dig into other data types on the documentation...