React 공식문서로 디테일 잡기(초급)

eunhye·2022년 5월 12일
0
post-thumbnail

22.05.12

1. 공식문서를 보는 이유와 방법

- 리액트를 시작으로 여러 라이브러리들의 공식문서를 보면서 바로 써보기
- 이해 해보기, 두가지 방식을 썩어서 연습
- 반복해보자

공식문서 -> 라이브러리 설명서
공식문서 읽기 -> 리액트로 시작 후 반복 숙달

2.환경설정

VSCODE -> IDE
node, npm, npx -> create-react-app
VSCODE 설치 - node.js 설치 - VSCODE 실행 - 터미널 클릭 후 npx create-react-app my-app
cd my-app
npm start

새로운 React 앱 만들기
https://ko.reactjs.org/docs/create-a-new-react-app.html

3.JSX

JSX 없이 사용하는 React
https://ko.reactjs.org/docs/react-without-jsx.html

JSX 이해하기
https://ko.reactjs.org/docs/jsx-in-depth.html

JSX -> React.createElement 표현식

4. Props

Components와 Props
https://ko.reactjs.org/docs/components-and-props.html

Props -> 컴포넌트에 전달되는 단일 객체
순수함수처럼 동작 -> Props 자체를 수정해서는 안됨
컴포넌트 합성 -> 여러 컴포넌트를 모아서
컴포넌트 추출 -> 여러곳에서 사용되거나 / 복잡한 경우

5. State

State and Lifecycle
https://ko.reactjs.org/docs/state-and-lifecycle.html

컴포넌트 내의 상태 -> 자신의 출력값을 변경
Class component -> State LifeCycle
Functional component -> 훅으로 관리
유의사항 -> 직접 수정 X / 비동기적일 수도 있음

6. 컴포넌트 생명주기

React.Component
https://ko.reactjs.org/docs/react-component.html

constructor -> state 초기화 및 데이터 바인딩
componentDidMount -> Dom 노드 초기화 및 데이터 fetch
componentWillUnmount -> 타이머 제거 및 요청 취소 및 구독 해제
Functional Component -> hook으로 대부분 구현 가능

0개의 댓글