You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: allow to use Record and other Iterables as default state value (#58)
* fix: correct test glob pattern
* feat: allow using custom default state
* test: add tests for custom default state
* docs: update README with custom default state usage
By default, if `state` is `undefined`, `rootReducer(state, action)` is called with `state = Immutable.Map()`. A different default function can be provided as the second parameter to `combineReducers(reducers, getDefaultState)`, for example:
// state now must always have 'foo' property with its default value returned from fooReducer(undefined, action)
59
+
```
60
+
61
+
In general, `getDefaultState` function must return an instance of `Immutable.Iterable` that implements `get`, `set` and `withMutations` methods. Such iterables are `List`, `Map`, `OrderedMap` and `Record`.
62
+
40
63
### Using with `react-router-redux`
41
64
42
65
`react-router-redux`[`routeReducer`](https://github.com/reactjs/react-router-redux/tree/v4.0.2#routerreducer) does not work with Immutable.js. You need to use a custom reducer:
0 commit comments