react 的生命周期函数

生命周期函数:

是指在某一时刻组件自动执行 的函数

初始化:

设置props和state

mounting:

componentWillMount 在组件即将被挂载到页面的时候自动执行

render 组件在页面上进行挂载

componentDidMount 在组件被挂载到页面的时候后自动执行

updation:组件更新

props

=>componentWillPeceiveProps=>shouldComponentUpdate=> componentWillUpdate=>render=> componentDidUpdate

state

=>shouldComponentUpdate=> componentWillUpdate=>render=> componentDidUpdate

unmounting:

即将被从页面去除组件的时候

原文地址:https://www.cnblogs.com/guangzhou11/p/9801083.html