How to deploy a React app to Heroku in 4 simple steps

How to deploy a React app to Heroku in 4 simple steps

You might have just started working with react, a Javascript library for building user interfaces, and you have reached the stage of deployment. There are various platforms to deploy your react app, there is platform such as AWS, EC2, Heroku, Netlify, etc. If your tool of choice is Heroku, then this article is for you.

Note: Heroku provides buildpack for Node JS and Python apps and not create-react-app. We will be adding a community buildpack (github.com/mars/create-react-app-buildpack) while deploying to Heroku so as to make the build process automated.

STEP 1: Create a GitHub repository

If you don't have a GitHub account, Open one and go through the docs for better understanding. Done setting up your repo? Push to it.

STEP 2: Creating a new App on Heroku

-->Open an account on Heroku

--> Create a new app on Heroku

-->Insert the name you will want to give to your app

-->Choose a region (Anywhere close to you)

heroku2.png

STEP 3: Adding a buildpack

heroku3_LI.jpg

Go to your settings tab and click on "Add Buildpack". Paste this link github.com/mars/create-react-app-buildpack as explained above.

heroku5.png

STEP 4: Connecting to GitHub -->Connect to GitHub. Search and choose the repository you created and connect.

heroku6_LI.jpg

P.S: Enable automatic deploys to get automatic updates on your app whenever you push to Heroku

-->Deploy branch

heroku7.png

Congratulations... You've successfully deployed your React app to Heroku.

Untitled design.png