createMutable
Edit this pagecreateMutable
creates a new mutable Store proxy object that provides a way to selectively trigger updates only when values change.
By intercepting property access, it allows automatic tracking of deep nesting via proxy making it useful for integrating external systems or serving as a compatibility layer with frameworks like MobX or Vue.
It's important to recognize that a mutable state, which can be passed around and modified anywhere, may complicate the code structure and increase the risk of breaking unidirectional flow.
For a more robust alternative, it is generally recommended to use createStore
instead.
Additionally, the produce
utility can provide many of these same benefits without the associated downsides.
Mutables support setters along with getters.