We all have been to the stage where we had completed our first react app but didn't know how to showcase it publicly.
So, in this blog, I am going to show you how to host your react app for free.
Pre-requisites:
- Make sure you have completed building a react app.
- Have npm installed locally or globally.
Step 1
Once you are done with your react app, you need to create the build folder which will contain the index, stylesheets, icons, assets and manfiest files. This folder is responsible for serving your static content when deployed.
Use this command in the root dir of your app
npm run build
Step 2
There are so many platforms to host your static site like Netlify, Vercel, Github Pages, Cloudflare Pages, Forge, etc. We are going to use Netlify
So, you need to create an account on Netlify and log in.
Step 3
Click on the add new site
button.
Then, click on the deploy manually
button to deploy your build folder directly.
Step 4
Now, we have 2 options to deploy it. We can do it either by browsing our local files or dragging and dropping.
- Click on the browse files to upload the folder from your local machine.
- Drag the folder from your local and drop it in the middle.
Step 5
Now, Netlify will publish your site and host it for free. You will be provided a random url but you can change it to your preferance.
Note: The url for your site should be unique and will always end with
netlify.app
Congratulations! ✨ You have hosted your react app successfully and now you can showoff your project to your friends, family and literally anyone on this planet 😉
If you have any query, drop it in the comment section below. If you think this blog has any error or wrong info, please let me know.
I hope I could help you somehow 😀. If yes, please share it with your friends and others so that this could benefit them too! Till then , keep REACT-ing ❤🚀
Top comments (8)
That was quit easy, thanks ❤️
Glad to help !!
Nicely written... Expecting more blogs from you 🔥
Thanks mate. I will try my best 😎
Follow the instructions step by step. But I get a "Page Not Found" error. any idea why?
When are u getting the 404 error?
When I try to access the website after it deploys.
Deploying issue ig.Try redeploying. Let me know after doing it.