react umi dva antdreact

react 生命周期,超详细哦

2019-12-16  本文已影响0人  逸笛

组件生命周期有三种:

每个状态都配有Will 和 Did相应的处理函数

componentWillMount()
componentDidMount()
componentWillUpdate(object nextProps, object nextState)
componentDidUpdate(object prevProps, object prevState)
componentWillUnmount()

两个特殊状态的处理函数

componentWillReceiveProps(object nextProps):已加载组件收到新的参数时调用
shouldComponentUpdate(object nextProps, object nextState):组件判断是否重新渲染时调用
图片.png

工作主线:
一、初始化
constructor()

ComponentWillMount()

第一次render

二、挂载

componentDidMount

第二次render

三、更新

componentWillUpdate

四、卸载

componentWillUnmount

上一篇 下一篇

猜你喜欢

热点阅读