3 ms·
You probably know this, but for anyone else reading, the problem is that if you assign an object or array using const, the object/array members are still mutabl
by pault 10y ago
You probably know this, but for anyone else reading, the problem is that if you assign an object or array using const, the object/array members are still mutable. If you have a tree structure, you have to recursively Object.freeze the entire tree to get immutability, which AFAIK is basically what immutable.js does for you. I also use const by default, but I find that more often than not my variables are trees and lists.