DEV Community

Cover image for deploy react to github pages
Le Hong Son
Le Hong Son

Posted on

deploy react to github pages

deploy react to github pages

hello bro today I will share you a way publish react application with github pages.
Let's follow me !!
install package gh-pages

step 1:

install package gh-pages

yarn add gh-pages -D 
Enter fullscreen mode Exit fullscreen mode

step 2:

add config gh-pages in package.json
2.1 open package.json change homepage

"homepage": "http://tomnyson.github.io/vercel-demo",

change tomnyson = your account github
change vercel-demo = your projec name github
2.2 add code in block scripts

  "scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build"
  },
Enter fullscreen mode Exit fullscreen mode

*2 line code above show react build before deploy *
2.2 deploy code

yarn deploy
Enter fullscreen mode Exit fullscreen mode

resource

github project example

Top comments (0)