# 發布react app到github 1. npx create-react-app appname 2. package.json ``` // package.json { "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", + "predeploy": "npm run build", // 這邊使用 npm 或 yarn 就看你啟動專案的方式 + "deploy": "gh-pages -d build", // ... } } ``` ``` "homepage": "https://username.github.io/repositoryname" ``` 3. npm install --save gh-pages 4. npm run deploy 5. 將github branch切到gh-page 6. 在github settings page 發布