There are a couple of ways to ensure a new object with a new pointer.
- the spread operator
- Object.Assign
- deep copy
- the "deep clone merge function" of redux.utility.ts which has a lot of wacky rules and exception cases and maybe should be avoided
Addendum 12/4/2018: Item 4 above is bad. The lodash way could serve as a replacement however:
var foo = _cloneDeep(bar);
Addendum 12/6/2018: should be cloneDeep not _cloneDeep
No comments:
Post a Comment