Integrate seamless-immutable with Redux
Wraps the default state and the results of calling handleActions
from redux-actions in an Immutable
.
Using npm.
npm install --save redux-seamless-reducers
Using yarn.
yarn add redux-seamless-reducers
import { handleActions } from 'redux-seamless-reducers';
const DefaultState = {};
const actions = {
'ACTION': (state, action) => {
return { ...state };
}
};
export default handleActions(actions, DefaultState);
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.
this.props.myImmutableArray.map(this.renderItemInArray)
instead you need to use the following approach.
// using native JavaScript
[].map.call(this.props.myImmutableArray, this.renderItemInArray)
// using underscore/lodash
_.map(this.props.myImmutableArray, this.renderItemInArray)
Type: object
An action-type-to-reducer map.
Type: object
The default state of the reducer.
MIT