标签:ops 并且 native render rop pen nat should update
react native 的两个核心的属性控制改变组件:props和state。| 方法名 | 作用 | 调用次数 |
|---|---|---|
| constructor | 构造函数,初始化需要的state | 1次 |
| componentWillMount | 控件渲染前触发 | 1次 |
| render | 渲染控件的方法 | 多次 |
| componentDidMount | 控件渲染后触发 | 1次 |
| componentWillReceiveProps | 组件接收到新的props时被调用 | 多次 |
| shouldCompentUpdate | 当组件接收到props和state时被调用 | 多次 |
| componentWillUpdate | props或者state改变,并且此前的shouldComponentUpdate为true会调用该方法 | 多次 |
| componentDidUpdate | 组件重新渲染完成后会调用此方法 | 多次 |
| componentWillUnmount | 组件卸载和销毁之前被调用 | 1次 |
标签:ops 并且 native render rop pen nat should update
原文地址:http://blog.51cto.com/13955864/2176093