react

react 시작하기

김으엉 2024. 7. 15. 17:59

프로젝트를 새로 시작할 일이 빈번하지 않아서 가끔씩 까먹기 때문에

시작하는 방법을 쭉 정리 해보겠습니다!

 

전부 다 노드 명령어로 "VScode의 터미널" 에서 실행하면 됩니다.

터미널을 여는 법은

 

작업영역의 하단에 마우스를 올렸을 때의 파란선을 마우스로 드래그해서 올리거나

 

 

좌측상단 터미널 메뉴에서 새 터미널을 선택해 열어줍니다.

 

 

 

프로젝트 생성(노드 명령어)

  • 프로젝트  이름  : example
$ npx create-react-app example

 

 

아래와 같은 문구가 나오면 프로젝트를 만드는데 성공한 것입니다.

 

Success! Created music at C:\Users\*파일경로*\example Inside that directory, you can run several commands:
npm start
  Starts the development server.
npm run build
  Bundles the app into static files for production.
npm test
  Starts the test runner.
npm run eject
  Removes this tool and copies build dependencies, configuration files and scripts into the app directory. If you do    this, you can’t go back!
We suggest that you begin by typing:
cd example
npm start
npm start

Happy hacking!

 

react 개발환경 실행

$ npm start

 

브라우저에서  실행  확인(http://localhost:3000)

 

 

 

내용 출처: https://create-react-app.dev/