본문 바로가기
React

Component 의 LifeCycle

by 정정훈의 아날로그 2021. 4. 22.

라이프사이클 메서드에

Will 접두사가 붙은 메서드는 어떤 작업을 작동하기 전 실행

Did 접두사가 붙은 메서드는 어떤 작업을 작동한 후 실행

 

render() 함수

constructor 메서드

getDerivedStateFromProps 메서드

componentDidMount 메서드

shouldComponentUpdate 메서드

getSnapshotBeforeUpdate 메서드

componentDidUpdate 메서드

componentWillUnmount 메서드

 

라이프사이클 메서드는 세가지 카테고리로 나눌수 있다.

마운트 - DOM이 생성되고 웹 브라우저상에 나타나는 것.

업데이트 - props 나 state 가 바뀔때, 부모 컴포넌트가 리랜더링될 때, this.forceUpdate로 강제로 랜더링을 트리거할 때 ??

언마운트 - 마운트의 반대, Component 를 DOM 에서 제거하는것

 

예제는 다음 포스팅에 추가하겠다.

'React' 카테고리의 다른 글

shouldComponentUpdate 메서드  (0) 2021.04.22
Component 의 LifeCycle 예제  (0) 2021.04.22
map() + @  (0) 2021.04.21
Component 에 ref 설정하기  (0) 2021.04.20
ValidationSample.js ( ref 함수 사용 + 유효성 검사 예제 )  (0) 2021.04.20