首页 > 其他 > 详细

A12 React+AntDesign React 生命周期函数

时间:2020-03-11 01:09:17      阅读:54      评论:0      收藏:0      [点我收藏+]

React 生命周期函数

/*   
生命周期函数
    组件加载之前,组件加载完成,组件更新数据以及组件销毁触发的一系列方法---这就是组件的生命周期函数

组件加载的时候触发的生命周期函数:

    constructor、UNSAFE_componentWillMount(老版本为componentWillMount,已废弃)、
    render、componentDidMount

组件更新的时候触发的生命周期函数:

    shouldComponentUpdate(有两个参数nextProps,nextState)、 
    UNSAFE_componentWillUpdate(老版本为componentWillUpdate,已废弃)、
    render、componentDidUpdate

你在父组件里面改变props传值的时候触发的:

    componentWillReceiveProps

组件销毁时触发的生命周期函数:

    UNSAFE_componentWillReceiveProps(老版本为componentWillUnmount,已废弃)

*/

//新版本React以rename的生命周期函数
// componentWillMount → UNSAFE_componentWillMount
// componentWillReceiveProps → UNSAFE_componentWillReceiveProps
// componentWillUpdate → UNSAFE_componentWillUpdate
 
技术分享图片

 技术分享图片

 技术分享图片

 技术分享图片

 技术分享图片

 

 

 

 

A12 React+AntDesign React 生命周期函数

原文:https://www.cnblogs.com/nuister/p/12459737.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!