content: import React, { Component } from 'react';
  
  class LifeCycle extends Component {
  
    static defaultProps = {
      value: '开始渲染'
    }
  
    componentWillReceiveProps(nextProps){
      console.log('componentWillReceiveProps');
      this.setState({
          value: nextProps.value
      });
    }
  
    /**
     * diff 数据对比
     * 对比完成，如果数据没有差异，不更新
     * return false
     * @param  {[type]} nextProps [description]
     * @param  {[type]} nextState [description]
     * @return {[type]}           [description]
     */
    shouldComponentUpdate(nextProps,nextState){
      console.log('shouldComponentUpdate');
      return true;
    }
  
    componentWillUpdate(nextProps,nextState){
      console.log('componentWillUpdate');
    }
  
    componentWillMount(){
      console.log('componentWillMount');
    }
  
    render() {
      console.log('render');
      return <span>{this.props.value}</span>
    }
  
    componentDidMount() {
        console.log('componentDidMount');
    }
  
    componentDidUpdate(prevProps,prevState) {
        console.log('componentDidUpdate');
    }
  
    componentWillUnmount(prevProps,prevState) {
        console.log('componentWillUnmount');
    }
  }
  
  export default LifeCycle;
  