미미 공부/취미방

[노마드 코더] Component Life Cycle #3.2 본문

Programming

[노마드 코더] Component Life Cycle #3.2

mionager 2021. 10. 23. 16:51

https://nomadcoders .co/courses

1) React Component가 하는 일 세가지

Mounting, Updating, Unmounting

2) Mounting

코드가 만들어지고 뿌려지는 함수들 

  1. constructor() : 바닐라 자바스크립트에서 온 애(class를 이해해야됨)
  2. static getDerivedStateFromProps()
  3. render()
  4. componentDidMount()

3) Update

데이터(state)가 업데이트 될때 동작하는 함수들

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

4) Unmounting

코드가 없어질때 동작하는 함수들 (페이지가 바뀔때 등)

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