TypeScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist Fix issue with null references Jul 30, 2018
src Fix issue with null references Jul 30, 2018
test Fix issue with null references Jul 30, 2018
typings
.codeclimate.yml
.gitignore
.npmignore Add codeclimate config Jan 29, 2017
.travis.yml
LICENSE
README.md
jsonapi.md
package-lock.json Bump version to 4.3.1 Jul 30, 2018
package.json
tsconfig.json Started work on network layer Mar 5, 2017
tslint.json Handle HTTP statuses correctly, add Record baseUrl support, Store req… Apr 16, 2017
typings.json

README.md

mobx-jsonapi-store

JSON API Store for MobX

Don't need any JSON API specific features? Check out mobx-collection-store.

Can be used with Redux DevTools.

Build Status Test Coverage npm version

Dependency Status devDependency Status Greenkeeper badge

Basic example

import {Store} from 'mobx-jsonapi-store';

const store = new Store();
const user = store.sync(userResponse); // Assumption: userResponse was received from some API call and it's a valid JSON API response
console.log(user.name); // "John"

For more, check out the Getting started guide.

Installation

To install, use npm or yarn. The lib has a peer dependency of mobx 2.7.0 or later (including MobX 3) and mobx-collection-store.

npm install mobx-jsonapi-store mobx-collection-store mobx --save
yarn add mobx-jsonapi-store mobx-collection-store mobx

Since the lib is exposed as a set of CommonJS modules, you'll need something like webpack or browserify in order to use it in the browser.

Don't forget to prepare your code for production for better performance!

Migration from v3 to v4

Version 4 has a few breaking changes described in the migration guide.

Getting started

The main idea behind the library is to have one instance of the store that contains multiple model types. This way, there can be references between models that can handle all use cases, including circular dependencies.

JSON API Spec

mobx-jsonapi-store is 100% compatible with the JSON API v1.0 spec

API reference

License

The MIT License

Credits

mobx-jsonapi-store is maintained and sponsored by Infinum.