drborges / arbor-store

Seamless state management made with ❤️
https://github.com/drborges/arbor-store
8 stars 0 forks source link

Support #destroy operation #55

Open drborges opened 3 years ago

drborges commented 3 years ago

It would be quite convenient if we could easily remove branches of the state tree by simply calling node.$destroy().

If node is a child of an object, the operation would be delete parent[nodeProp]. In case the node is an array item, the operation can be fulfilled by Array.splice.

Remove elements from arrays is a common operation in React apps which should make a case for this API. Removing props from objects seems a little less common, but could still be handy should the user decide to build normalized key/value stores.