react课堂笔记九之生命周期函数

React生命周期函数:

    组件加载之前,组件加载完成,以及组件更新数据,组件销毁。

    触发的一系列的方法 ,这就是组件的生命周期函数

1.组件加载的时候触发的函数: 

    constructor 、componentWillMount、 render 、componentDidMount

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

    shouldComponentUpdate、componentWillUpdate、render、componentDidUpdate

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

    componentWillReceiveProps

4.组件销毁的时候触发的(由被销毁组件触发):

    componentWillUnmount

猜你喜欢

转载自blog.csdn.net/weixin_39247773/article/details/87861995