Redux state is undefined in mapStateToProps. You reducer doesn’t have a default action in switch statement. Which is why even though you mentioned the initial state in reducer params, undefined is returned as store initial state
1 2 3 4 5 6 7 8 9 10 11 12 | import React from 'react'; import {Map,fromJS} from 'immutable'; const reducer = (state = Map() ,action) => { switch(action.type){ case 'SET_STATE': return state.merge(action.state); default: return state; } } export default reducer; |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.