mobx-keys-store
Installation
npm install mobx-keys-store
Usage
; const initialState = {};const store = initialState; /* * Observe the store and its properties */ store;store;
Documentation
Constructor
The constructor can receive an object with initial keys.
Store methods
setItem(name, value)
setItem adds a new or updates an existing property.
removeItem(name)
removeItem removes a property from the store.
increaseItem(name, [amount=1])
increaseItem will increase the value of the selected property.
decreaseItem(name, [amount=1])
decreaseItem will decrease the value of the selected property
Note
If you try to observe a property which doesn't yet exist, you might not be notified once the property is added. That's why it might be best to add the property to the initial store values.
License
The MIT License
© 2016 Infinum Inc.