react basics (작성중)

그린그레이프·2020년 6월 10일
0

list

  • props
  • state
  • context
  • refs
  • lifecycle

context


#. what?

to transfer value deepdown to components tree

#. why?

하나의 컴포넌트 트리가 특정값을 공유해야 하는 경우, props 을 사용하는 것은 비효율적일 수 있다.

#. 주의할점?

여러 컴포넌트가 참조할 수 있는 상위 스코프에 변수를 지정하는 것은 위험하다. 가능하면 상수를 사용하는게 좋을 것 같다.

lifeCycle


#. life cycle method?

We can declare special methods on the component class to run some code when a component mounts and unmounts

어떤 코드를 특정한 시점에 실행하도록 해주는 것.
react 는 가상돔 방식을 사용하기 때문에, 컴포넌트의 mount(unmount), update 등의 시점에 특정한 코드를 수행하도록 지정할 수 있다.

profile
제대로 걷는 한걸음이 곧 백걸음이다

0개의 댓글