April 2018
Intermediate to advanced
284 pages
6h 43m
English
In flat state, we have the benefit of dealing with nested resource and in the Immutable object, we have the benefit of a declared state that cannot be modified.
The other benefit of the Immutable object is that with their reference level equality checks, we can have fabulous improved rendering performance. In Immutable, we have an example of shouldComponentUpdate:
shouldComponentUpdate(nexProps) { // instead of object deep comparsion return this.props.immutableFoo !== nexProps.immutableFoo}
In JavaScript, use of Immutability Deep freeze node will help you to freeze a node before mutation, and then it will verify results. The following example shows the same logic:
return { ...state, foo}return arr1.concat(arr2)