Redux & Immutable integration
- An alternative to combineReducers that supports ImmutableJs for store initial state.
- An optional handler map reducer creator with immutable support.
combineReducers it is possible to provide
createStore with initial state using Immutable Iterable type, i.e:
;; ;; const reducer = ;const state = Immutable; const store = ;reducer store;
Immutable Handler Map reducer creator
createReducer is an optional function that creates a reducer from a collection of handlers. In addition to
getting rid of the switch statement, it also provides the following benefits:
- If the given
initialStatetype is mutated, it will get converted to an immutable type.
- An error is produced in case a reducer handler returns a mutated state (not recommended but this behavior can be disabled)
const initialState = Immutable /** * Reducer domain that handles authentication & authorization. **/initialState LOGIN: state LOGOUT: domain
If you want to specify the Immutable type to be used for implicit conversion, pass an constructor function at the end:
ADD_STUFF: state true ::ImmutableOrderedSet;
Please note that this is optional and
combineReducers should work just fine if you prefer the old
How this library is different from 'redux-immutable' ?
This library doesn't dictate any specific reducer structure.
redux-immutable focuses on CRC, this library
provides some conversion middlewares from FSA to CCA
and vise versa. If you feel like going with Redux's vanilla is the right approach, then consider using our library.