2.3 Lifecyle
- Instantiation
1.1 The lifecycle methods that are called the first time an instance is created
- getDefaultProps
- getInitialState
- componentWillMount
- render
componentDidMount
1.2 For all subsequent uses of that component class:getInitialState
- componentWillMount
- render
componentDidMount”
- Lifetime
componentWillReceiveProps
- shouldComponentUpdate // return true|false
shouldComponentUpdate(nextProps, nextState) {
return nextProps.id !== this.props.id;
}
- componentWillUpdate //not called for the initial render
- render
componentDidUpdate
- Teardown & cleanup
componentWillUnmount
原文: https://unbug.gitbooks.io/react-native-training/content/23_lifecyle.html