Show HN: MobX-Style Observables in Svelte(github.com) |
Show HN: MobX-Style Observables in Svelte(github.com) |
Not clear what this solves or improves upon.
``` $: value = $x + 2 ```
but you can do that somewhere else as well
``` $: { let y = 20 $value += y } ```
Makes it insanely hard to track where changes come from. You can't say "this value is _only_ updated by these changes".
You can do this with derived stores, though. But each store must be it's own, separate value - with MobX's observable you have a central object representing your entire state, each of which is made automatically reactive, and putting in a derived store is just prepending with -get-. It's much cleaner.