This repository has been archived by the owner on Sep 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Darko Kukovec edited this page Jul 1, 2017
·
11 revisions
Structured data store for MobX. Partially influenced by Backbone Collections.
Using JSON API? Check out mobx-jsonapi-store - All mobx-collection-store features, and JSON API helpers in one place.
import {Collection} from 'mobx-collection-store';
const collection = new Collection();
const john = collection.add({
id: 1,
firstName: 'John',
lastName: 'Doe'
});
const jane = collection.add({
id: 2,
firstName: 'Jane',
lastName: 'Doe'
});
console.log(collection.length); // 2
john.lastName = 'Williams';
console.log(john.lastName); // 'Williams'
For more advanced use-cases, check out the getting started guide, or the examples folder.
The main idea behind the library is to have one instance of the collection that contains multiple model types. This way, there can be references between models that can handle all use cases, including circular dependencies.
- Installation
- Defining models
- References
- Configuring the collection
- Using the collection
- Persisting data locally
- Redux DevTools
The library contains the following elements:
The MIT License
mobx-collection-store is maintained and sponsored by Infinum.