Programming
[노마드 코더] Component Life Cycle #3.2
mionager
2021. 10. 23. 16:51
1) React Component가 하는 일 세가지
Mounting, Updating, Unmounting
2) Mounting
코드가 만들어지고 뿌려지는 함수들
- constructor() : 바닐라 자바스크립트에서 온 애(class를 이해해야됨)
- static getDerivedStateFromProps()
- render()
- componentDidMount()
3) Update
데이터(state)가 업데이트 될때 동작하는 함수들
- static getDerivedStateFromProps()
- shouldComponentUpdate()
- render()
- getSnapshotBeforeUpdate()
- componentDidUpdate()
4) Unmounting
코드가 없어질때 동작하는 함수들 (페이지가 바뀔때 등)
- static getDerivedStateFromProps()
- shouldComponentUpdate()
- render()
- getSnapshotBeforeUpdate()
- componentDidUpdate()