React 15 라이프사이클

Jinmin Kim·2022년 8월 4일
0

componentWillReceiveProps(nextProps)

componentWillReceiveProps(nextProps){
  console.log("componentWillReceiveProps: " + JSON.stringify(nextProps));
}

컴포넌트 생성후에 첫 렌더링을 마친 후 호출되는 메서드
컴포넌트가 처음 마운트 되는 시점에서는 호출되지 않으며 props를 받아서 state를 변경해야 하는 경우 유용. 이 메소드 내부에서 setState를 사용해도 추가적인 렌더링이 발생하지 않는다.

profile
Let's do it developer

0개의 댓글