React的componentWillUpdate获取不到更新的props值(redux)
来源:互联网 发布:杭州优化妆学校排行 编辑:程序博客网 时间:2024/06/06 03:44
使用redux更新store中的值,引起对应组件的update,在componentWillUpdate中,使用对应的props值时,发现并没有变化, 在mapStateToProps中,打断点,state是已经变化了的,但是componentWillUpdate函数中确实还是之前的值,在render中打断点,又是已经变化了的,百度之后,发现在render时,才会把更新后的store值,赋给this.props;componentWillUpdate中this.props的值还是更新前的,如果要获取更新后的,componentWillUpdate、componentDidUpdate和shouldComponentUpdate一样,具有两个参数,nextProps,nextState,下一个要获取的值就在这里。
阅读全文
0 0
- React的componentWillUpdate获取不到更新的props值(redux)
- React Native的this.props获取属性
- vue props 拿不到值的解决方案
- react and redux(一)props和state
- React和Redux的连接react-redux
- React和Redux的连接react-redux
- React和Redux的连接react-redux
- React和Redux的连接react-redux
- React和Redux的连接react-redux
- React和Redux的连接react-redux
- React和Redux的连接react-redux
- React、Redux、React-Redux的一些理解
- react 在是事件里不能获取props的问题
- react-redux的理解
- React-Redux 的用法
- React-Redux 的用法
- react使用props的原则
- React的props和state
- [BZOJ1266]-[AHOI2006]上学路线route-SPFA+最小割
- 【Java基本知识】抽象类与接口对比
- 二分
- Apt和dpkg快速参考
- 作用域、上下文、闭包、原型、继承
- React的componentWillUpdate获取不到更新的props值(redux)
- 计算几何-离散化
- How to install compiz
- python 3 中的time模块使用(待完善)
- Harris 角点检测
- 解决mac上matplotlib(plot)无法显示中文的问题 (Python)
- Java 数据类型转换
- java基础三:Arraylist和LinkList区别
- 先后出现Requested setting DEFAULT_INDEX_TABLESPACE和No module named