삐옹

230516 본문

WIL

230516

삐옹 2023. 5. 16. 12:58

리액트 공문 내용 정리

 

State: A Component's Memory 파트

  • useState return two items which are state and setter function
    => one is state variable, the other is
    setter function which can update the state variable and trigger react to render the component again. And trigger again and again with same phase.
  • “Hook” is special function that is only available while react is rendering starting with “use” 
  • State is private and isolated(parent dosen’t know anything - state etc) unlike props
  • 로컬변수는 re-render시 상태 기억을 하지 못 하기때문에 input value값을 제대로 업데이트 하지못한다.  
  • 로컬변수로 해결 있는건 state 굳이 쓰지않아도됌. 예를 들어 컴포넌트의 재렌더링하는 동안 어떤 정보를 유지할 필요가 없을 때 혹은 단독 이벤트 핸들러 안에서 동작하는 경우. 

용어

render: 리액트가 props와 state를 기반으로 ui를 어떻게 그릴지 컴포넌트에게 작업 요청하는 것.

'WIL' 카테고리의 다른 글

230520 공문번역  (0) 2023.05.20
230517  (0) 2023.05.18
220504  (1) 2023.05.04
231223  (0) 2022.12.23
항해 1주차  (0) 2022.05.16