react生命周期函数详解

react生命周期函数图详解 根据上图我们来说一下react中的生命周期函数 react中的生命周期函数主要分为三个阶段创建、更新、销毁 创建阶段 getDefaultProps() 此阶段为组件初始化,定义propTypes或者defaultProps getInitialState() 与getDefaultProps的区别在于前者设置默认的 props,后者设置初始的state在使用es6的
相关文章
相关标签/搜索