Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- Github Actions
- 스파르타코딩클럽
- 비동기
- imagePreview
- react
- setstate
- 개발
- rendering
- 라우팅
- updater
- 후기
- 미리보기
- Preview
- 채팅방
- routing
- 배포
- 브라우저 렌더링
- 항해99
- socket.io
- qwe
- FileReader
- CI/CD
- previousState
- useEffect
- S3
- 동기
- 접근 제한 라우팅
- route
- Redux
- 7기
Archives
- Today
- Total
삐옹
230516 본문
리액트 공문 내용 정리
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를 어떻게 그릴지 컴포넌트에게 작업 요청하는 것.