/ github

React - host in GitHub

In these months I'm playing with React, Redux and ES6.
I fell in love with the Meteor ecosystem some year ago, and one of the things I appreciated a lot, was the ability to easily deploy the project online.

I was happy to find a way to deploy the project in a similar way with React application created with create-react-app.

Here's how:

  1. Add an homepage field in your package.json

     "homepage": "https://myusername.github.io/my-app"
    
  2. Install gh-pages

    yarn add gh-page
    
  3. Add the deploy to your command, in package.json

      "scripts": {
         "predeploy": "npm run build",
         "deploy": "gh-pages -d build",
         ...
    
  4. Deploy:

     yarn deploy
    

PS. Be sure to have the GitHub Pages are enabled in your
GitHub settings

References:
create-react-app in GitHub