Book Image

MobX Quick Start Guide

By : Pavan Podila, Michel Weststrate
Book Image

MobX Quick Start Guide

By: Pavan Podila, Michel Weststrate

Overview of this book

MobX is a simple and highly scalable state management library in JavaScript. Its abstractions can help you manage state in small to extremely large applications. However, if you are just starting out, it is essential to have a guide that can help you take the first steps. This book aims to be that guide that will equip you with the skills needed to use MobX and effectively handle the state management aspects of your application. You will first learn about observables, actions, and reactions: the core concepts of MobX. To see how MobX really shines and simplifies state management, you'll work through some real-world use cases. Building on these core concepts and use cases, you will learn about advanced MobX, its APIs, and libraries that extend MobX. By the end of this book, you will not only have a solid conceptual understanding of MobX, but also practical experience. You will gain the confidence to tackle many of the common state management problems in your own projects.
Table of Contents (17 chapters)
Title Page
Packt Upsell


I started my journey on Reactive Programming several years ago, when Reactive Programming on frontend wasn't "a thing".

At the beginning, there weren't many references or books available to apply this paradigm on frontend applications; therefore, I had to spent a lot of time extracting the key concepts of Reactive Programming from books on Java or Clojure, university white papers, and blog posts.

In the past two years though, slowly but steadily, the community started developing many frameworks and libraries that shape the frontend Reactive ecosystem we know nowadays.

Reactive Programming is getting a lot of traction. Companies such as Netflix, Microsoft, IBM, and many others are using this paradigm, leveraging the strong decoupling provided out of the box by this paradigm and the unidirectional data flow used in many Reactive state management systems.

From the developers, community, we had a strong push on sharing great reactive implementations, such as Rx.JS, Cycle.js, VueX, SAM patterns, Angular with NGRX, and many others.

There is one though that is standing out from the crowd, created by a bunch of smart developers; it is called MobX.

MobX is the perfect companion for starting your journey on Reactive Programming. It is easy to learn, applies reactivity with a few lines of code, and it could be used without deeply knowing this paradigm. It can also be used for digging into the reactive programming roots.

MobX ecosystem provides the flexibility of structuring small projects, such as a Proof of Concept (PoC), or large projects managed by several teams, thanks to MobX State Tree (MST).

I had the opportunity to work on both MobX and MST: I created some simple PoCs for validating my theories, and also architected a micro-frontend system with tens of developers working with MST.

I saw how well thought out and designed this system was and how fast it was, picking it up from scratch, by other developers.

As you will discover in these pages, MobX will provide you with the flexibility smartness behind architectural and design decisions that you were looking for. It is the perfect companion for any experienced person or a newcomer to the reactive programming movement.

Enjoy your journey into MobX and MST, I'm sure you won't regret it!

Luca Mezzalira

Author, Speaker, Chief Architect at DAZN, Google Developer Expert and manager of the London JavaScript community