1. 리액트 16.3 버전 이전

컴포넌트 생성 및 Mount

class Component extends React.Component {
    <u>**constructor**</u>(props) {
      super(props)

      console.log("constructor")
    }

    <u>**render**</u>() {
      console.log("render")

      return (
        <div></div>
      )
    }

    <u>**componentWillMount**</u>() {
      console.log("componentWillMount")
    }

    <u>**componentDidMount**</u>() {
      console.log("componentDidMount")
    }
  }

컴포넌트 props, state 변경

// props를 새로 지정한 직후
componentWillReceiveProps(nextProps) {

}

// 컴포넌트가 재 렌더링되기 직전
componentWillUpdate(nextProps, nextState) {

}

// 컴포넌트가 재 렌더링된 직후
componentDidUpdate(prevProps, prevState) {

}

// true를 반환하면 render 함수 재호출 O,
//false를 반환하면 render 함수 재호출 X
shouldComponentUpdate(newProps, newState) {
	// 리턴 기본값은 true
}

컴포넌트 Unmount

componentWillUnmount() {
	// 컴포넌트가 사라지기 전에 
}

2. 리액트 16.3 이후 버전

변경된 함수

componentWillMount, componentWillReceiveProps
=> <u>**static**</u> <u>**getDerivedStateFromProps**</u>(nextProps, prevState) {
			console.log('~~')
			return { 새로운 state }	
		}

<u>****</u>componentWillUpdate
=> <u>**getSnapshotBeforeUpdate**</u>(prevProps, prevState) {
		return 값	
	}

<u>****</u>componentDidUpdate(prevProps, prevState)
=> componentDidUpdate(prevProps, prevState, <u>**snapshot**</u>)