Front-end/React
[React] LifeCycle API
이안92
2020. 12. 13. 20:13
반응형
constructor
컴포넌트가 새로 만들어질 때 호출
getDerivedStateFromProps
props값을 state와 동기화시키고 싶을 때
shouldComponentUpdate
컴포넌트가 update할 지 말 지 정할 때 (false은 호출이 안되며 true일 때 호출됨)
render
렌더 함수 호출
getSnapshotBeforeUpdate
실제로 브라우저에 반영되기 바로 직전에 값을 확일할 때
componentDidMount
Mounting이 끝날 때
componentDidUpdate
Updating이 끝날 때
componentWillUnmount
Unmounting이 될 때
componentDidCatch
에러발생 시 잡을 때
반응형