Do state updates need to be by assignment?
julianeden opened this issue · comments
That is to say, is this okay? Are there issues with this?
store.update(s => s.someArray.push(newValue);
As opposed to....
store.update(s => { s.someArray = [...s.someArray, newValue]; });
Nope, no issues at all with the first one there. If you'd like to know more about how you can mutate things in Pullstate- behind the scenes it is using Immer to do all updates, so you can take a look at their documentation to understand it better.
Part of the great thing about Immer is that you don't need to do it by assignment- you can just "mutate" the incoming value directly and it will take care of the rest.