Deploy on GitHub Pages
- Install package
npm install gh-pages — save-dev
2. Add a homepage property in the package.json and deploy scripts
Go to your package.json and write
“homepage”: “https://{username}.github.io/{repo-name}"
Under “scripts” add two lines:
+ “predeploy”: “npm run build”,+ “deploy”: “gh-pages -d build”,
3. Connect your project with a GitHub repository
git remote add origin https://github.com/{username}/{repo-name}.git
4. Deploy the app to GitHub Pages
npm run deploy
That will cause the predeploy and deploy scripts defined in package.json to run.
5. Push code to GitHub repo
git add .git commit -m “Configure React app for deployment to GitHub Pages”git push origin master
It takes some time.
6. Check
Under Pages in your settings you have the branch gh-pages chosen with root

7. Voila look at your beautiful app! :)