DEV Community

Himanshu Vishwas
Himanshu Vishwas

Posted on

2

Host React website with GitHub pages in ten simple steps.

Using Visual Studio Code.....

Step 1. First, add your repository using source control (Ctrl+Shift+G) on GitHub.
Step 2. Open terminal
Step 3.

git install gh-pages
Enter fullscreen mode Exit fullscreen mode

Step 4.
In package.json add following in first block before "name" :

"homepage": "https://<githubId>.github.io/<repoName>",
Enter fullscreen mode Exit fullscreen mode

Step 5. In package.json, inside "scripts" block, add the following after "start":

"predeploy": "npm run build",
"deploy": "gh-pages -d build",

Enter fullscreen mode Exit fullscreen mode

Step 6. Save the file and open terminal

Step 7.git add .
Step 8. git commit -m "deploying webpage"
Step 9. git push
Step 10. npm run deploy

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay