react生命周期知识点

                           react生命周期知识点

一个React组件的生命周期分为三个部分:实例化、存在期和销毁时。

实例化

组件在客户端被实例化,第一次被创建时,以下方法依次被调用:

1、getDefaultProps
2、getInitialState
3、componentWillMount
4、render
5、componentDidMount

当组件在服务端被实例化,首次被创建时,以下方法依次被调用:

1、getDefaultProps
2、getInitialState
3、componentWillMount
4、render

猜你喜欢

转载自www.cnblogs.com/mahmud/p/10134559.html