Deploying React apps to Github pages

Framework/Tools

If you want to host your static web apps, github page is certainly one of the best option. You can share both your code and demo in one place.

First create a react app in your local machine using the command npm init react-app app-name. Install gh-pages with npm install --save gh-pages and write the following lines in your package.json file.

{
    "homepage": "https://myusername.github.io/app-name",
    "name":"app-name",
    .
    .
  }
  .
  .
  .
  "scripts":{
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
  }
  //Add and commit all changes.