@heridux/immutable
v0.0.1
Published
Use heridux with ImmutableJS
Downloads
3
Maintainers
Readme
Table of Contents
HeriduxImmutable
Extends Heridux
Creation of Heridux store
Parameters
STATE_PROPERTY
String 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
prop
String property namevalue
any property value
Returns undefined
get
Get js value of a first level key
Parameters
key
String key namestate
Immutable.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
path
Array Iterable key path (more details in Immutable.js documentation)state
Immutable.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"]) // foo
Returns 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
state
Object plain js state
Returns undefined