react生命周期

总的来说 React 组件的生命周期有三种状态

1、mounting: 插入真实 DOM //渲染前后
2、updating: 正在被重新渲染 props 或 state 改变 //更新前后
3、unmounting: 卸载 移除真实 DOM  //卸载前后
mounting 对应的函数
constructor()
componentWillMount()
render()
componentDidMount()
updating 对应的函数

componentWillReceiveProps()
shouldComponentUpdate()
componentWillUpdate()
render()
componentDidUpdate()
unmounting 对应的函数
componentWillUnmount()

 

posted @ 2021-08-13 10:27  dongxiaolei  阅读(41)  评论(0编辑  收藏  举报