React 发展
react16 的重大更新
- 采用了新的内核架构 Fiber
- 引入了
getDerivedStateFromProps、getSnapshotBeforeUpdate及componentDidCatch等三个生命周期函数 - 将
componentWillUpdate、componentWillReceiveProps和componentWillUpdate标记为不安全的方法。 - 全新的 Context API
为什么要删除这三个生命周期
2023年12月15日1分钟阅读
getDerivedStateFromProps 、 getSnapshotBeforeUpdate 及 componentDidCatch 等三个生命周期函数componentWillUpdate、componentWillReceiveProps 和 componentWillUpdate 标记为不安全的方法。为什么要删除这三个生命周期