RN中组件生命周期主要由三个部分组成:挂载,更新,移除
1.挂载
getInitialState() : 组件挂载前调用,一般用于设置组件初始状态
componentWillMount() : 挂载前立即调用
componentDidMount() : 挂载后立即执行
2.更新
componentWillReceiveProps() : 组件属性改变时调用
shouldComponentUpdate() : 当组件需要更新DOM时调用
componentWillUpdate() : 组件更新前调用
componentDidUpdate() : 组件更新后调用
3.移除
componentWillUnmount() : 销毁前调用