공부/React

create-react-app 설치 및 설정

뚠뚜 2023. 1. 22. 19:29

01. create-react-app 설치 방법

1. node.js 설치하기

1-1. 터미널을 열어서 node -v 명령어를 입력한 다음 제대로 다운이 완료되었는지 확인하기

2. 터미널에 npx create-react-app 폴더명 명령어를 입력하여 새로운 폴더 생성하기

"react-for-bigin" 부분이 폴더명

3. 생성된 폴더를 vsCode에 열어준다. 

3-1. package.json폴더에 있는 scripts에 start 부분을 확인한다.

 

4. 터미널에 npm start  또는 npm run start  명령어를 입력한 후 잠시 기다리면 development server(개발용 서버)를 오픈된다.

 

처음에 이렇게 생긴 홈페이지가 나온다.


02. create-react-app 초기 설정

1. index.js 폴더에서 빨간색으로 체크된 부분을 지운다.

2. App.js 폴더에서 빨간색으로 체크된 부분을 지운다.

3. src폴더에서 index.js와 App.js를 제외한 나머지 폴더를 지워준다

 


보너스

prop-types 설치

 

참고주소

https://github.com/facebook/create-react-app

 

GitHub - facebook/create-react-app: Set up a modern web app by running one command.

Set up a modern web app by running one command. Contribute to facebook/create-react-app development by creating an account on GitHub.

github.com