How and where to deploy your React App in less than 5 minutes.

How and where to deploy your React App in less than 5 minutes.

When you have developed several applications and you want to showcase them to everyone on internet, You do not need to buy domain because it is very easy to host your application on several free platforms such as Github Pages, Netlify, Vercel, Heroku, may more.

In this article, I'll show you how you can create a React App and deploy it using Github Pages.

Step 1 : Create a React App

  • Fire up Visual Studio Code.
  • Open Terminal and run command npx create-react-app myapp.
  • Navigate to your application directory cd myapp and run npm start to start your react app.
  • If you have successfully executed above commands then you will likely to see your browser as shown below and your application is running at local server at this address http://localhost:3000/.

image.png

Step 2 : Now Deploy the above created application to Github

  • Now we see we haven't even created a Github Repository. So access to https://github.com/ and create a repository name it same as your application name which is myapp.
  • Make sure you have to create a Public Repository because Github Pages won't be able to take Private Repository.
  • As soon as you Click on "Create Repository", You will see few commands to run. Move to Visual Studio Code and in terminal Start running these following commands to set up remote as Origin.
  • Navigate to your application directory and run
  • git init.
  • git add .
  • git commit -m "first commit".
  • git remote add origin <your repository link>.
  • git push -u origin main.
  • Now go to Github and refresh the page, you will see all the code that you pushed.
  • Go to Settings and scroll till "Github Pages" and select source as "Master Branch".
  • That's it... You will see your website is published at a certain address which is accessible to everyone.

Conclusion: As we saw we have successfully deployed our React App on Github Pages, There are many other alternatives as well to deploy your app such as Netlify and Vercel. I personally like to do with "Netlify". Let me know in the comment box what all other options you are willing and tried out.

Thanks for reading!!

Did you find this article valuable?

Support Nikhil Khandelwal by becoming a sponsor. Any amount is appreciated!