React V16.3生命周期:The Component Lifecycle Flowchart

发布时间:2019-06-28 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了React V16.3生命周期:The Component Lifecycle Flowchart脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
学习React免不了对组件生命周期的学习,我们应该掌握最新生命周期,学以致用,以达到性能优化的目的。

The component Lifecycle

React Version: 16.3

1 生命周期可视化

高清大图--欢迎转载

React V16.3生命周期:The Component Lifecycle Flowchart

2 简要总结:

  • 去掉了3个方法
  1. componentWillMount
  2. componentWillReceiveProps
  3. componentWillUpdate
  • 增加了2个方法
  1. static getDerivedStateFromProps(nextPRops, prevState)
  2. getSnapshotBeforeUpdate(prevProps, prevState)
  • 更改了1个方法,增加了第3个参数
  1. componentDidUpdate(prevProps, prevState, snapshot)

官网说是为了实现将来新版本的异步渲染In order to support async rendering

最后

如有兴趣深入了解同学,可以到官网了解最新资讯

官网文档: https://reactjs.org/docs/react-component.html#static-getderivedstatefromprops

脚本宝典总结

以上是脚本宝典为你收集整理的React V16.3生命周期:The Component Lifecycle Flowchart全部内容,希望文章能够帮你解决React V16.3生命周期:The Component Lifecycle Flowchart所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。