February 2018 Donations
Project highlight: MobX
MobX is designed to enable building web applications with a complex data model in an intuitive and very performant manner. Using React and MobX is currently the simplest way to build component based web applications.
Single page web application state management is notably a hard problem to solve in large projects. Unlike projects like Backbone and Vue, which included their own state management solutions, React ecosystem has gone through a lot of iterations when it comes to state libraries and patterns. While it’s easy to get started with React’s build-in
setState, it doesn’t scale well for larger applications and it forces you to bundle your application logic with view logic.
MobX is a small but full-fledged state library for React applications. Together with its React sister library, mobx-react, it’s almost as easy to as
setState to get started with, but it also scales easily to larger applications. Unlike Redux, another popular state management library, which usually is coupled with other libraries to better handle asynchronous API calls and memoized selectors, MobX is very much a “batteries included” solution with a minimal API.
Example code above includes a simple React component with separated state store, which fetches data from an external API, shows a loading indicator and handles errors. Thanks to
observer, component is updated automatically after state values are updated and
Both Coinbase and GDAX have been using MobX in production for over a year at this point and it has proven to be extremely stable and reliable. Thanks to its simplicity, getting new developers onboarded to the codebase is easy and fast.
Michel still accounts for the majority of the code contributions to the core library but majority of the new development is done on
mobx-state-tree package, which is a more opinionated state container build on top of core MobX library. If you’re looking for a simple state manager, it’s worth a look.
Thanks for all the hard work Michel and other contributors have put into MobX. It has helped us build products faster and help Coinbase scale. We can’t wait to share more project highlights in the coming months!