Learn how immutable.js data structures is different from native iterable Javascript data types and why they provide an ex Cellent Foundation on which to build your application ' s state.
Instead of them being mutable, they ' re always immutable, meaning they don ' t change from underneath. The reference to them can change, but the data inside them cannot, which means you can build predictable and reliable stat E models on top of them. It becomes a lot easier to manage your application ' s state.
console.clear (); const ARY= ["Todo1", "Todo2"];const Ary2=Ary;console.log (ary[0]);//Todo1ary2[0] = "done1"; Console.log (ary[0]);//done1//Immutablefunctionupdatestate (immutable, POS, value) {returnImmutable.set (pos, value);} Const Immutablestate= Immutable.list (["Foo1", "Foo2"]); Const IMMUTABLESTATE2= Immutablestate.set (0, "bar1"); Console.log (Immutablestate.get (0));//foo1Console.log (immutablestate2.get (0));//bar1
Every time you use Set () to set a new value, immutable would return a new array.
[Javascript] Manage application state with Immutable.js