Deploying React to HerokuExcept for a few steps, deploying React applications to Heroku is similar to Django (Part II.) If you have already gone through many of the previous chapters, you will not have any trouble with deploying React either.
Open your command-line interface or shell!
$ heroku login
$ heroku create /your-heroku-app-name/
You should create a new app on Heroku to deploy your local app there.
Add new buildpack to Heroku app settings!
In order to add create-react-app buildpack to Heroku, you have to do the following:
Add this: https://buildpack-registry.s3.amazonaws.com/buildpacks/mars/create-react-app.tgz To here: https://dashboard.heroku.com/apps/your-heroku-app/settings
It is recommended to create new repository on GitHub for this project. See more about git/github!
If you have created a new repository followed by the upper link, then you must ignore those commands among the next, which are already done, and only focus on $ heroku git:remote -a /your-heroku-app/ and the commands about deploying on the bottom!
$ cd /react-app-folder/
$ git init
$ heroku git:remote -a /your-heroku-app/
$ git add .
$ git commit -m "initial"
$ git push heroku main
$ heroku open