0.0.1 • Published 5 years ago
@heridux/immutable v0.0.1
Table of Contents
HeriduxImmutable
Extends Heridux
Creation of Heridux store
Parameters
STATE_PROPERTYString string name for this slice of state. Generated actions wille use this as a prefix.
set
Set a first level value without creating a specific action
Parameters
propString property namevalueany property value
Returns undefined
get
Get js value of a first level key
Parameters
keyString key namestateImmutable.Map? global state (if not specified, call getState method of redux store)
Returns any key value (converted in plain js if immutable)
getIn
Get js value of a nested key
Parameters
pathArray Iterable key path (more details in Immutable.js documentation)stateImmutable.Map? global state (if not specified, call getState method of redux store)
Examples
const store = new Heridux("myPartialStore")
store.setInitialState({
list : [{ name : "foo"}, { name : "bar" }]
})
store.getIn(["list", 0, "name"]) // fooReturns any key value (converted in plain js if immutable)
setInitialState
Define the initial state of the store slice. It will automatically be converted to immutable.
Parameters
stateObject plain js state
Returns undefined
0.0.1
5 years ago