[react] 생명주기 메서드의 순서는 어떻게 되나요?
마운팅: 컴포넌트가 처음으로 생성될 때 발생하는 단계입니다.
constructor()
static getDerivedStateFromProps()
render()
componentDidMount()
업데이팅: 컴포넌트의 상태나 속성이 변경될 때 발생하는 단계입니다.
static getDerivedStateFromProps()
shouldComponentUpdate()
render()
getSnapshotBeforeUpdate()
componentDidUpdate()
언마운팅: 컴포넌트가 제거될 때 발생하는 단계입니다.
componentWillUnmount()
이러한 생명주기 메서드의 순서를 이해하면 컴포넌트가 언제 특정한 작업을 수행하는지 더 잘 이해할 수 있습니다.