본문 바로가기

프론트엔드 공부/react

component 라이프사이클 변경(v16.3이후)

component 라이프사이클 변경(v16.3이후)
getDerivedStateFromProps(<componentWillMount)
getDerivedStateFromProps(<ComponentWillRecieveProps)
getSnapshotBeforeUpdate(<ComponentWillUpdate:렌더직후로 변경)

1.initiallizition
constructor 
2.Mounting
getDerivedStateFromProps> render> componentDidMount
3.Updation(props state변경)
-props
  getDerivedStateFromProps>shouldComponentUpdate
  >render>getSnapshotBeforeUpdate>componentDidUpdate
-state(
  shouldComponentUpdate>render > getSnapshotBeforeUpdate(dom에적용 직전)>componentDidUpdate

componentDidUpdate
componentWillUnmount