Requirements:
- Node / NPM — Click the link and download the installer
- Git — Click the link and download the installer
- Heroku CLI — Click the link and download the installer
With your terminal still, open navigate to your React app folder and change directory into it. Now we need to connect our project to Heroku. If you haven’t already installed the Heroku CLI. To make sure it’s installed correctly run this command:
- heroku — version
You should see your Heroku CLI version. Once that is installed we need to setup up Heroku git repository by running these commands:
- heroku login (Enter your Heroku credentials)
- git init
- git add .
- git commit -m “initial commit”
- heroku create (You should see two links after running this command. Copy the second one)
- git remote add heroku PASTE THE LINK YOU JUST COPIED
- git push heroku master
Once you run the last command Heroku will start to run some tests on your app. If everything goes right you should see a successful deploy message. Now you’re able to navigate to your app by running:
- heroku open
Anytime you make changes to your app and want to re-deploy the only commands you need to run are:
- git add .
- git commit -m “any message goes here”
- git push heroku master
Enjoy your free hosting! Cheers...