LegendApp / legend-state

Legend-State is a super fast and powerful state library that enables fine-grained reactivity and easy automatic persistence
https://legendapp.com/open-source/state/
MIT License
2.72k stars 81 forks source link

Docs: How does this compare to mobx? #27

Open ScottAwesome opened 1 year ago

ScottAwesome commented 1 year ago

I'm seeing alot of similarities between this library and mobx, and I'm wondering what the future holds in this regard. (I admit I thought it was going to be based on rxjs style observables due to the nomenclature, but digging in further it appears to be very mobx-ish)

I think it would be good to compare the two, since the core APIs appear to be similar, and I even see some Flow constructs like mobx uses.

Curious if that was a source of inspiration here!

jmeistrich commented 1 year ago

The original inspiration was Knockout.js. When we switched Legend from that to React in 2015 I didn't like any of the state libraries at the time so I built an observable system loosely based on how we'd used Knockout. We've been iterating on that over the years until we rewrote it from scratch using Proxy, which turned into this library.

The observer HOC and a few of the api features like when were inspired by what I read in the mobx docs, and the fine-grained reactivity features were mostly inspired by Knockout, Solid, and Svelte.

I've never actually used mobx though, so I'm not fully sure of how they compare. We do get the request for comparison pretty often though, so it would be good to do a real writeup. If you'd like to contribute to that it would be super helpful, otherwise I'd have to do a deep dive into mobx before I could write up a good comparison.