Immutable Redux
In this lesson, we will use Immutable.js in our Weather app that's created using React and Redux
We'll cover the following...
we make the initial state in our reducer an immutable object by using the fromJS
function! We simply wrap the object that we assign to initialState
in fromJS
like so:
// reducer.js
/* … */
import { fromJS } from 'immutable';
var initialState = fromJS({
/* … */
});
/* … */
Now we need to rework our reducer. Since our state is now immutable, instead of doing Object.assign({}, state, { /* … */ })
...