All Projects → xaviergonz → Mobx Keystone

xaviergonz / Mobx Keystone

Licence: mit
A MobX powered state management solution based on data trees with first class support for Typescript, support for snapshots, patches and much more

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Mobx Keystone

mutable
State containers with dirty checking and more
Stars: ✭ 32 (-88.73%)
Mutual labels:  state-management, mobx, functional-reactive-programming, frp
Reflex Platform
A curated package set and set of tools that let you build Haskell packages so they can run on a variety of platforms. reflex-platform is built on top of the nix package manager.
Stars: ✭ 602 (+111.97%)
Mutual labels:  reactive, frp, functional-reactive-programming
Reflex
Interactive programs without callbacks or side-effects. Functional Reactive Programming (FRP) uses composable events and time-varying values to describe interactive systems as pure functions. Just like other pure functional code, functional reactive code is easier to get right on the first try, maintain, and reuse.
Stars: ✭ 910 (+220.42%)
Mutual labels:  reactive, frp, functional-reactive-programming
reflex-dom-semui
A reflex-dom API for Semantic UI components
Stars: ✭ 22 (-92.25%)
Mutual labels:  reactive, functional-reactive-programming, frp
Reflex Dom
Web applications without callbacks or side-effects. Reflex-DOM brings the power of functional reactive programming (FRP) to the web. Build HTML and other Document Object Model (DOM) data with a pure functional interface.
Stars: ✭ 301 (+5.99%)
Mutual labels:  reactive, frp, functional-reactive-programming
purescript-pop
😃 A functional reactive programming (FRP) demo created with PureScript events and behaviors.
Stars: ✭ 33 (-88.38%)
Mutual labels:  reactive, functional-reactive-programming, frp
Sodium Typescript
Typescript/Javascript implementation of Sodium FRP (Functional Reactive Programming) library
Stars: ✭ 102 (-64.08%)
Mutual labels:  reactive, frp, functional-reactive-programming
reflex-dom-ace
Reflex wrapper for the ACE editor
Stars: ✭ 12 (-95.77%)
Mutual labels:  reactive, functional-reactive-programming, frp
reactive-states
Reactive state implementations (brainstorming)
Stars: ✭ 51 (-82.04%)
Mutual labels:  reactive, state-management, frp
Mobx Rest
REST conventions for Mobx
Stars: ✭ 164 (-42.25%)
Mutual labels:  reactive, state-management, mobx
Mobx.dart
MobX for the Dart language. Hassle-free, reactive state-management for your Dart and Flutter apps.
Stars: ✭ 2,038 (+617.61%)
Mutual labels:  reactive, state-management, mobx
agile
🌌 Global State and Logic Library for JavaScript/Typescript applications
Stars: ✭ 90 (-68.31%)
Mutual labels:  reactive, state-management, functional-reactive-programming
reflex-native
Framework for writing fully native apps using Reflex, a Functional Reactive Programming library for Haskell.
Stars: ✭ 40 (-85.92%)
Mutual labels:  reactive, functional-reactive-programming, frp
Airstream
State propagation and event streams with mandatory ownership and no glitches
Stars: ✭ 160 (-43.66%)
Mutual labels:  state-management, functional-reactive-programming
whatsup
Reactive framework, simple, fast, easy to use!
Stars: ✭ 115 (-59.51%)
Mutual labels:  reactive, state-management
react-coat-ssr-demo
Demo with Typescript + React + Redux for server-side-rendering (SSR)
Stars: ✭ 100 (-64.79%)
Mutual labels:  state-management, mobx
demonstration-gsd
GSD (Get your Stuff Done) | Basic Todo list for demonstrating CQRS/Command Sourcing in Haskell
Stars: ✭ 46 (-83.8%)
Mutual labels:  functional-reactive-programming, frp
fpEs
Functional Programming for EcmaScript(Javascript)
Stars: ✭ 40 (-85.92%)
Mutual labels:  reactive, functional-reactive-programming
Radioactive State
☢ Make Your React App Truly Reactive!
Stars: ✭ 273 (-3.87%)
Mutual labels:  reactive, state-management
reactify
The first and only true Functional Reactive Programming framework for Scala.
Stars: ✭ 77 (-72.89%)
Mutual labels:  reactive, frp

mobx-keystone

A MobX powered state management solution based on data trees with first-class support for Typescript, snapshots, patches and much more

npm license types

CircleCI Coveralls github Netlify Status

Full documentation can be found on the site:

mobx-keystone.js.org

Introduction

mobx-keystone is a state container that combines the simplicity and ease of mutable data with the traceability of immutable data and the reactiveness and performance of observable data, all with a fully compatible Typescript syntax.

Simply put, it tries to combine the best features of both immutability (transactionality, traceability and composition) and mutability (discoverability, co-location and encapsulation) based approaches to state management; everything to provide the best developer experience possible. Unlike MobX itself, mobx-keystone is very opinionated about how data should be structured and updated. This makes it possible to solve many common problems out of the box.

Central in mobx-keystone is the concept of a living tree. The tree consists of mutable, but strictly protected objects (models, arrays and plain objects). From this living tree, immutable, structurally shared snapshots are automatically generated.

Another core design goal of mobx-keystone is to offer a great Typescript syntax out of the box, be it for models (and other kinds of data such as plain objects and arrays) or for its generated snapshots.

To see some code and get a glimpse of how it works check the Todo List Example.

Because state trees are living, mutable models, actions are straightforward to write; just modify local instance properties where appropriate. It is not necessary to produce a new state tree yourself, mobx-keystone's snapshot functionality will derive one for you automatically.

Although mutable sounds scary to some, fear not, actions have many interesting properties. By default trees can only be modified by using an action that belongs to the same subtree. Furthermore, actions are replayable and can be used to distribute changes.

Moreover, because changes can be detected on a fine-grained level, JSON patches are supported out of the box. Simply subscribing to the patch stream of a tree is another way to sync diffs with, for example, back-end servers or other clients.

Since mobx-keystone uses MobX behind the scenes, it integrates seamlessly with mobx and mobx-react. Even cooler, because it supports snapshots, action middlewares and replayable actions out of the box, it is possible to replace a Redux store and reducer with a MobX data model. This makes it possible to connect the Redux devtools to mobx-keystone.

Like React, mobx-keystone consists of composable components, called models, which capture small pieces of state. They are instantiated from props and after that manage and protect their own internal state (using actions). Moreover, when applying snapshots, tree nodes are reconciled as much as possible.

Requirements

This library requires a more or less modern Javascript environment to work, namely one with support for:

  • MobX 6, 5, or 4 (with its gotchas)
  • Proxies (when using MobX 5, or MobX 6 with the proxies setting enabled)
  • Symbols
  • WeakMap/WeakSet

In other words, it should work on mostly anything except it won't work in Internet Explorer.

If you are using Typescript, then version >= 3.7.3 is recommended, though it might work with older versions.

Installation

npm install mobx-keystone

yarn add mobx-keystone

Full documentation

Full documentation can be found on mobx-keystone.js.org

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].