react componentDidMount 生命周期只加载一次没更新页面问题

因为componentDidMount生命周期只执行一次,所以在数据有变化的时候并不会更新页面,这时候可以使用

componentWillReceiveProps(nextProps) {} 生命周期更新值更新页面。
posted @ 2021-08-16 17:36  小小鱼丸  阅读(702)  评论(0编辑  收藏  举报