3 ms·
To change the state, you can use the regular JavaScript array mutation methods such as push(). Internally, Automerge translates this mutable API call in
by namuol 9y ago
To change the state, you can use the regular JavaScript array mutation
methods such as push(). Internally, Automerge translates this mutable API
call into an update of the immutable state object. Note that we must pass in
doc1, and get back an updated object which we assign to the same variable
doc1. The original document object is not modified.
Hmm. I like having the _option_ to use mutations to describe changes to the document, but in many cases I would actually prefer to use pure functions. Can I just return a new document with the necessary changes? I don't see any such examples in the docs here.