我是用echarts插件,没用immutable是可以的,但看echarts的option层级太深,所以改为immutable。
把initialState改成immutable的,在connect改回原生对象,我debugger了这个函数能获取到数据。但到了componentWillReceiveProps就变成undefined了。这是为什么啊?
const mapStateToProps = (state)=>{
debugger;
console.log(state.toJS());
return state.toJS();
}
componentWillReceiveProps(){
debugger
//里面获取值变成了undefined
}