As I can see in https://medium.com/@fastphrase/practical-guide-to-using-immutablejs-with-redux-and-react-c5fd9c99c6b2 It should be possible to use Record as initialValue, but using combineReducers I get an Error, if I use Immutable.Record instead of Immutable.Map in redux createStore . Please explain.
I use redux-immutable's combineReducers and all my reducers now made with Immutable.Record.
But as it is in example in redux-immutable github examples, store should be created with Immutable.Map as initialState.
const initialState = Immutable.Map()
const store = createStore(rootReducer, initialState)
I tried to change it to
const initialState = Immutable.Record()
const store = createStore(rootReducer, initialState)
But I'm getting errors from Immutable lib. Is there some workaround? It could be very helpful, if someone point me in the right direction.
PS. "react-redux": "5.0.5"
The main reason for the issue is API.
Using Record as initialState allows to get data from state in connected components I can:
export default connect(
state => ({
someProp: state.reducer.value
})
)(SomeComponent)
With Map i can only get data:
export default connect(
state => ({
someProp: state.getIn(['reducer', 'value'])
})
)(SomeComponent)
As I can see in https://medium.com/@fastphrase/practical-guide-to-using-immutablejs-with-redux-and-react-c5fd9c99c6b2 It should be possible to use Record as
initialValue, but usingcombineReducersI get an Error, if I useImmutable.Recordinstead ofImmutable.MapinreduxcreateStore. Please explain.I use
redux-immutable'scombineReducersand all my reducers now made withImmutable.Record.But as it is in example in
redux-immutablegithub examples, store should be created withImmutable.Mapas initialState.I tried to change it to
But I'm getting errors from Immutable lib. Is there some workaround? It could be very helpful, if someone point me in the right direction.
PS. "react-redux": "5.0.5"
The main reason for the issue is API.
Using
Recordas initialState allows to get data from state inconnected components I can:With
Mapi can only get data: