Publishing to a Website
BACK: React
This can also be done using Heroku See here!
After creating your app, we can use some server to host it. Github Pages saves the day! To start, we need to install some packages from npm.
$ npm install --save gh-pages
After doing so, we have to edit the package.json
file to tell it to use this. Add the following lines:
"homepage": "https://mchen0037.github.io/react-tutorial"
"predeploy": "npm run build"
"deploy": "gh-pages -d build"
Now we can build and deploy!
$ npm run deploy
This will create a gh-pages branch inside your repository, which Git sees and treat the files as a static website.
Make sure that the homepage you type in is the same as the repository name–I didn’t do this and I ended up publishing an empty web page to the wrong website.