0.0.1 • Published 3 years ago

@heridux/immutable v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

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 name
  • value any property value

Returns undefined

get

Get js value of a first level key

Parameters

  • key String key name
  • state 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

Returns undefined