March 2018
Intermediate to advanced
364 pages
8h 21m
English
The other thing we can undertake is adding immutability. The reasons for using immutability in the first place are to make your code more predictable, and some frameworks can use this for simpler change detection and can rely on reference checking over dirty checking. This was the case when AngularJS got its whole change detection mechanism changed when Angular was written. From a practical standpoint, this means that there are functions we can target in our store and apply immutable principles on. The first principle is to not mutate but create an entirely new state, instead of where the new state is the old state + the state change. A simple example of this is the following:
var oldState = 3;var newState = oldState + ...
Read now
Unlock full access