All Projects → mobxjs → Mobx Examples

mobxjs / Mobx Examples

Licence: mit
A collection of simple mobx examples

Labels

mobx-examples

A collection of simple mobx examples. All the examples below have been written in ES5 without JSX. No transpiling required. Please feel free to make any suggestions for improvement.

Baseline JSFiddle Includes: React, lodash, mobx, mobxReact, and mobxDevtools.

Baseline JSFiddle with decorators Includes: React, mobx, mobxReact. Thanks @spion!

MobX stand-alone examples

Please note that I have created a console.log override that prints the console.logs out to the results window on JSFiddle.

Creating Observables

Reactions

Computed Values

  • computed
    Note how the computed fullName is cached.

Actions

  • action
    Non-strict action usage. You may still set values outside of the actions.

  • action strict mode
    Strict action usage. OPEN YOUR CONSOLE. You should see an error where I try to set firstName directly. Note how easy it is to see the cause in the stack.

Utils

React + MobX examples

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