All Projects β†’ mobxjs β†’ Mobx State Tree

mobxjs / Mobx State Tree

Licence: mit
Full-featured reactive state management without the boilerplate

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Mobx State Tree

mst-effect
πŸ’« Designed to be used with MobX-State-Tree to create asynchronous actions using RxJS.
Stars: ✭ 19 (-99.7%)
Mutual labels:  state-management, mobx, observable, mst, mobx-state-tree
mst-persist
Persist and hydrate MobX-state-tree stores (in < 100 LoC)
Stars: ✭ 75 (-98.81%)
Mutual labels:  mobx, mst, state-tree, mobx-state-tree
mutable
State containers with dirty checking and more
Stars: ✭ 32 (-99.49%)
Mutual labels:  state-management, mobx, observable
micro-observables
A simple Observable library that can be used for easy state management in React applications.
Stars: ✭ 78 (-98.77%)
Mutual labels:  state-management, mobx, observable
ngx-mobx
Mobx decorators for Angular Applications
Stars: ✭ 14 (-99.78%)
Mutual labels:  state-management, mobx
react-mobx-router
Create React App with React Router 4 and MobX + Internationalization
Stars: ✭ 90 (-98.58%)
Mutual labels:  mobx, mobx-state-tree
NObservable
MobX like observable state management library with Blazor support
Stars: ✭ 66 (-98.96%)
Mutual labels:  state-management, mobx
redux-leaves
Write once. Reduce anywhere.
Stars: ✭ 52 (-99.18%)
Mutual labels:  state-management, state-tree
hooksy
Simple app state management based on react hooks
Stars: ✭ 58 (-99.08%)
Mutual labels:  state-management, mobx
react-coat-ssr-demo
Demo with Typescript + React + Redux for server-side-rendering (SSR)
Stars: ✭ 100 (-98.42%)
Mutual labels:  state-management, mobx
react-mobx-router5
React components for routing solution using router5 and mobx
Stars: ✭ 58 (-99.08%)
Mutual labels:  mobx, observable
Mobx Keystone
A MobX powered state management solution based on data trees with first class support for Typescript, support for snapshots, patches and much more
Stars: ✭ 284 (-95.5%)
Mutual labels:  state-management, mobx
umi-plugin-mobx
😍 use mobx-state-tree gracefully in umijs.
Stars: ✭ 33 (-99.48%)
Mutual labels:  mobx, mobx-state-tree
vana
Observe your immutable state trees πŸŒ²πŸ‘€ (great with React)
Stars: ✭ 24 (-99.62%)
Mutual labels:  state-management, observable
mobx-state-tree-router
State-based router for React and MobX State Tree
Stars: ✭ 18 (-99.72%)
Mutual labels:  mobx, mobx-state-tree
mobx-router5
Router5 integration with mobx
Stars: ✭ 22 (-99.65%)
Mutual labels:  mobx, observable
Observable Slim
Observable Slim is a singleton that utilizes ES6 Proxies to observe changes made to an object and any nested children of that object. It is intended to assist with state management and one-way data binding.
Stars: ✭ 178 (-97.18%)
Mutual labels:  observable, state-management
Blue Chip
Normalizes GraphQL and JSON:API payloads into your state management system and provides ORM selectors to prepare data to be consumed by components
Stars: ✭ 332 (-94.74%)
Mutual labels:  state-management, mobx
reactive state
An easy to understand reactive state management solution for Flutter.
Stars: ✭ 19 (-99.7%)
Mutual labels:  state-management, observable
React Coat
Structured React + Redux with Typescript and support for isomorphic rendering beautifully(SSR)
Stars: ✭ 290 (-95.41%)
Mutual labels:  state-management, mobx

logo

mobx-state-tree

npm version CircleCI Codecov Have a question? Ask on GitHub Discussions!

What is mobx-state-tree?

Technically speaking, mobx-state-tree (also known as MST) is a state container system built on MobX, a functional reactive state library.

This may not mean much to you, and that’s okay. I’ll explain it like this: MobX is a state management "engine", and MobX-State-Tree gives it structure and common tools you need for your app. MST is valuable in a large team but also useful in smaller applications when you expect your code to scale rapidly. And if we compare it to Redux, MST offers better performance and much less boilerplate code than Redux!

MobX is one of the most popular Redux alternatives and is used (along with MobX-State-Tree) by companies worldwide. MST plays very well with TypeScript, React, and React Native, especially when paired with mobx-react-lite. It supports multiple stores, async actions and side effects, enables extremely targeted re-renders for React apps, and much more -- all in a package with zero dependencies other than MobX itself.

Note: you don't need to know how to use MobX in order to use MST.

Getting started

See the Getting started tutorial or follow the free egghead.io course.

πŸ‘‰ Official docs can be found at http://mobx-state-tree.js.org/

Quick Code Example

There's nothing quite like looking at some code to get a feel for a library. Check out this small example of an author and list of tweets by that author.

import { types } from "mobx-state-tree"

// Define a couple models
const Author = types.model({
    id: types.identifier,
    firstName: types.string,
    lastName: types.string
})
const Tweet = types.model({
    id: types.identifier,
    author: types.reference(Author), // stores just the `id` reference!
    body: types.string,
    timestamp: types.number
})

// Define a store just like a model
const RootStore = types.model({
    authors: types.array(Author),
    tweets: types.array(Tweet)
})

// Instantiate a couple model instances
const jamon = Author.create({
    id: "jamon",
    firstName: "Jamon",
    lastName: "Holmgren"
})

const tweet = Tweet.create({
    id: "1",
    author: jamon.id, // just the ID needed here
    body: "Hello world!",
    timestamp: Date.now()
})

// Now instantiate the store!
const rootStore = RootStore.create({
    authors: [jamon],
    tweets: [tweet]
})

// Ready to use in a React component, if that's your target.
import { observer } from "mobx-react-lite"
const MyComponent = observer((props) => {
    return <div>Hello, {rootStore.authors[0].firstName}!</div>
})

// Note: since this component is "observed", any changes to rootStore.authors[0].firstName
// will result in a re-render! If you're not using React, you can also "listen" to changes
// using `onSnapshot`: https://mobx-state-tree.js.org/concepts/snapshots

Thanks!

  • Michel Weststrate for creating MobX, MobX-State-Tree, and MobX-React.
  • Infinite Red for supporting ongoing maintenance on MST.
  • Mendix for sponsoring and providing the opportunity to work on exploratory projects like MST.
  • Dan Abramov's work on Redux has strongly influenced the idea of snapshots and transactional actions in MST.
  • Giulio Canti's work on tcomb and type systems in general has strongly influenced the type system of MST.
  • All the early adopters encouraging to pursue this whole idea and proving it is something feasible.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].