React 生命周期理解

页面初始化的时候生命周期函数执行顺序是   

componentWillMount('组件将要挂载到页面时刻')---------->render('组件正在被渲染'时刻)----------->componentDidMount('组件挂载完成时刻')

页面组件更新时候生命周期函数执行顺序是

shouldComponentWillUpdate('组件更新之前')---------->componentWillUpdate('组件即将更新')---------->render('组件正在被渲染')---------->

componentWillReceiveProps(在初始props不会被调用,它会在组件接受到新的props时调用,一般用于父组件更新状态时子组件的重新渲染,它是在不进行额外的render的前提下,

响应props中的改变并更新state的唯一方式)---------->componentDidUpdate('组件更新完成')

重命名的生命周期

componentWillMount---------->UNSAFE_componentWillMount



componentWillUpdate---------->UNSAFE_componentWillUpdate


componentWillReceiveProps---------->UNSAFE_componentWillReceiveProps
原文地址:https://www.cnblogs.com/h5it/p/14060192.html