initialize Component
class MyComponent extends Component() {
shouldComponentUpdate(nextProps, nextState){
// default return true, must make component update
}
componentWillUpdate(nextProps, nextState){
}
render(){
}
componentDidUpdate(prevProps, prevState){
}
}
class MyComponent extends Component() {
componentWillReceiveProps(nextProps){
}
shouldComponentUpdate(nextProps, nextState){
// default return true, must make component update
}
componentWillUpdate(nextProps, nextState){
}
render(){
}
componentDidUpdate(prevProps, prevState){
}
}
class MyComponent extends Component() {
constructor(props){
// Only execute one time
super(props)
this.state = {
color: '#FF0000'
}
}
componentWillMount(){
// Only execute one time
}
render(){
}
componentDidMount(){
// Only execute one time
}
}