DEV Community

Sabbir Shawon
Sabbir Shawon

Posted on

3 1

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️