1
私の読書によれば、これは問題ではありません(reduxはv3.3です)?私は間違って何をしていますか?combineReducersは不変のマップをプレーンなJSオブジェクトに変換します
rootReducer.js
import { combineReducers } from 'redux';
import { routeReducer } from 'react-router-redux';
import { reducer as reduxAsyncConnectReducer } from 'redux-async-connect';
import myReducer from './modules/myReducer';
export default combineReducers({
routeReducer,
reduxAsyncConnectReducer,
myReducer,
});
myReducer.js
import { Map } from 'immutable';
const initialState = Map({});
export default (state = initialState, action = {}) => {
switch (action.type) {
default:
// On the third run "@@INIT" the state gets converted from a Map to a plain JS object :(
console.log('action:', action.type, 'state:', state);
return state;
}
};
出力
action: @@redux/INIT
state: Map {size: 0, _root: undefined, __ownerID: undefined, __hash: undefined, __altered: false}
action: @@redux/PROBE_UNKNOWN_ACTION_x.5.a.b.w.u.f.k.8.3.q.b.s.5.e.e.4.5.c.d.i
state: Map {size: 0, _root: undefined, __ownerID: undefined, __hash: undefined, __altered: false}
action: @@INIT
state: Object {}