项目里使用,react redux ,发现在componentWillReceiveProps中 ,nextProps和this.props拿到的数据是相同的,不是在render阶段nextProps的值才会赋给this.props吗?
我在reducer里面这么写的:
let newState = {};
Object.assign(newState, state);
return newState;
这是个新对象了吧,不然只修改原来state的属性的话,组件是不会update的!
说明传过来的 props 就是相同的呗。
不是的,是在
componentWillReceiveProps
或者shouldComponentUpdate
后 https://github.com/facebook/r...