DEV Community

Cover image for Host React JS App for FREE with GitHub Pages
Samitha Wijesekara
Samitha Wijesekara

Posted on

Host React JS App for FREE with GitHub Pages

Commands Used

Step 1
▶️ git remote add origin [YOUR REPO LINK]
▶️ git add -A
▶️ git commit -m "Initial commit"
▶️ git push -u origin main

Step 2
Add this code line to package.json file -
▶️ "homepage": "https://[USERNAME].github.io/[YOUR REPO NAME]",

Step 3
▶️ npm install gh-pages --save-dev

Step 4
Add this scripts to package.json file -
▶️ "predeploy": "npm run build",
▶️ "deploy": "gh-pages -d build",

Step 5
▶️ npm run deploy

Top comments (0)