DEV Community

Sabbir Shawon
Sabbir Shawon

Posted on

How to deploy reactjs-app on GitHub Pages?

First create a react app using the terminal command

npm init react-app my-app

cd my-app

npm install gh-pages — save -dev

open package.json

add the following things of given below:

  1. “homepage”: “https://git_username.github.io/my-app/” before the name
  2. add scripts: “deploy”: “npm run build”, “deploy”: “gh-pages -d build”, and save this
  3. back to my-app directory
  4. git init
  5. git remote add origin https://github.com/user_name/my-app.git
  6. git push -u origin master
  7. npm run deploy

And the reactjs-app deployed to Github pages.

Top comments (0)