3 ms·
mobx-state-tree (https://mobx-state-tree.js.org/ https://mobx-state-tree.js.org/) Benefits of it over mobx is data normalization with references and JSON patch
by bhl 4y ago
mobx-state-tree (https://mobx-state-tree.js.org/ https://mobx-state-tree.js.org/)
Benefits of it over mobx is data normalization with references and JSON patches which allow you sync complex state easily. Typed models are also a plus.
Drawbacks are performance (see https://github.com/mobxjs/mobx-state-tree/issues/1267 https://github.com/mobxjs/mobx-state-tree/issues/1267).
Previously was using immer, which I loved because of immutability but moved off since classes and OOP didn't feel as natural as in mst.
If I were to pick an alternative, might try redux with normalization https://redux.js.org/usage/structuring-reducers/normalizing-state-shape https://redux.js.org/usage/structuring-reducers/normalizing-....
And if I were to build a state management tool, I would prioritize a library that has
- immutability
- JSON patches and snapshots
- data normalization with references
- schemas / models compatible with zod
- ralusek 4y agoI use this whenever I'm free to, and I was surprised it never caught on more.