[react] 생명주기 메서드의 순서는 어떻게 되나요?

마운팅: 컴포넌트가 처음으로 생성될 때 발생하는 단계입니다.

  1. constructor()
  2. static getDerivedStateFromProps()
  3. render()
  4. componentDidMount()

업데이팅: 컴포넌트의 상태나 속성이 변경될 때 발생하는 단계입니다.

  1. static getDerivedStateFromProps()
  2. shouldComponentUpdate()
  3. render()
  4. getSnapshotBeforeUpdate()
  5. componentDidUpdate()

언마운팅: 컴포넌트가 제거될 때 발생하는 단계입니다.

  1. componentWillUnmount()

이러한 생명주기 메서드의 순서를 이해하면 컴포넌트가 언제 특정한 작업을 수행하는지 더 잘 이해할 수 있습니다.