redux-seamless-reducers
Integrate seamless-immutable with Redux
Wraps the default state and the results of calling handleActions
from redux-actions in an Immutable
.
Install
Using npm.
npm install --save redux-seamless-reducers
Using yarn.
yarn add redux-seamless-reducers
Usage
; const DefaultState = {}; const actions = { return ...state ; }; actions DefaultState;
Pitfalls
Using with React
Beware that when you using map
on an immutable array, the array that is being returned is also an immutable object. This doesn't play nice with React. See this issue.
The following code will fail - where this.renderItemInArray
returns a React element.
thispropsmyImmutableArray
instead you need to use the following approach.
// using native JavaScriptmap // using underscore/lodash_
API
handleActions(handlers [, defaultState])
handlers
Type: object
An action-type-to-reducer map.
defaultState
Type: object
The default state of the reducer.
License
MIT