September 2017
Intermediate to advanced
216 pages
6h 8m
English
Mutative methods will return the same collection reference if nothing actually changes. This is what enables strict equality change detection. Transformation methods, on the other hand, don't have this capability. This means that if a transformation method results in the exact same collection values, it still returns a new reference. Let's look at the difference between mutated collections and transformed collections:
const myList = List.of( Map.of('one', 1, 'two', 2), Map.of('three', 3, 'four', 4), Map.of('five', 5, 'six', 6));const myTransformedList = myList.map(v => v);const myMutatedList = myList .update(0, v => v.set('one', 1));console.log('myList', myList.toJS());// -> myList [ { one: 1, ...Read now
Unlock full access