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
- New repository 생성
- $ git remote add origin ... 입력
- settings > github Page 도메인 생성
- package.json 추가 (homepage, scripts > predeploy, deploy)
"homepage" : "깃허브 도메인 주소",
"scripts" : {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
}
- $ yarn build 입력
- $ npm run deploy 입력
- setting > gitHub page > gh-page로 경로 변경
- 배포 완료 (약 5~10분정도 걸림)
Netlify
※ package.json에 추가한 homepage는 삭제할것
- $ npm install netlify-cli -g
- $ netlify deploy
- $ publish directory build
- $ netlify deploy
Third-party Library
Router
npm install react-router-dom --save
Sass
npm install node-sass --save