[TIL] 013. React command

홍효정·2020년 10월 1일
0

TIL

목록 보기
13/40

Creating an App

npx
$ npx create-react-app 폴더명
npm
$ npm init react-app 폴더명
yarn
$ yarn create react-app 폴더명




Server Start

npm
npm start




Deploy

GitHub
  1. New repository 생성
  2. $ git remote add origin ... 입력
  3. settings > github Page 도메인 생성
  4. package.json 추가 (homepage, scripts > predeploy, deploy)
"homepage" : "깃허브 도메인 주소",
"scripts" : {
  "predeploy": "npm run build",
  "deploy": "gh-pages -d build",
}
  1. $ yarn build 입력
  2. $ npm run deploy 입력
  3. setting > gitHub page > gh-page로 경로 변경
  4. 배포 완료 (약 5~10분정도 걸림)

Netlify

※ package.json에 추가한 homepage는 삭제할것

  1. $ npm install netlify-cli -g
  2. $ netlify deploy
  3. $ publish directory build
  4. $ netlify deploy




Third-party Library

Router
npm install react-router-dom --save
Sass
npm install node-sass --save
profile
HHJ velog 🍔

0개의 댓글