标签:should pre one before inf png 商业 链接 state
React的生命周期从广义上分为三个阶段:挂载、渲染、卸载
- 挂载卸载过程
1.1.constructor()
1.2.componentWillMount()
1.3.componentDidMount()
1.4.componentWillUnmount () - 更新过程
2.1. componentWillReceiveProps (nextProps)
2.2.shouldComponentUpdate(nextProps,nextState)
2.3.componentWillUpdate (nextProps,nextState)
2.4.componentDidUpdate(prevProps,prevState)
2.5.render() - React新增的生命周期(个人补充)
3.1. getDerivedStateFromProps(nextProps, prevState)
3.2. getSnapshotBeforeUpdate(prevProps, prevState)
作者:爱吃芋圆的小w
链接:https://www.jianshu.com/p/b331d0e4b398
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
react的生命周期
标签:should pre one before inf png 商业 链接 state
原文地址:https://www.cnblogs.com/Eant/p/14237388.html
暂无评论...