react 组件生命周期

Posted xiaomingblog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了react 组件生命周期相关的知识,希望对你有一定的参考价值。

1.初始化 Initalization

2.state/props更新 

3.销毁阶段 Destruction

一、initialization 

constructor() 构造阶段

componentWillMount() 模块将要安装

render     母鸡(递交)

componentDidMount  已生成

二、update

  componentWillReceiveProps()  收到数据变化?

  shouldCompnentUplate 将要更新?

  componentWillUpdate()

    在组件render之前执行且只会执行一次

  render

  componentDidUpdate

    在这里才生成dom树中 的节点,这个时候才能this.getDomNode()获取到对应节点

三、Destruction

  componentWillUnmount()

 

以上是关于react 组件生命周期的主要内容,如果未能解决你的问题,请参考以下文章

react 生命周期

[RN] React Native 中组件的生命周期

React-Native从入门到深入--组件生命周期

react 组件的生命周期

React生命周期

React中组件的生命周期(详细)