Nearby lessons
44 of 44🚀 ReactJS – Deployment
📌 What is React Deployment?
How to Deploy a React Application?
After building a React app, you need to deploy it so users can access it in a browser. Deployment means hosting your production-ready build on a server or a platform.
React provides a build folder with optimized static files that can be deployed to
services like Netlify, Vercel, GitHub Pages, or traditional web servers.
📦 Creating a Production Build
- Run
npm run buildto create a production build - This generates an optimized
build/folder - The build contains minified JavaScript, CSS, and HTML files
- These files are static and can be served by any web server
🌐 Deploying to Netlify
Netlify is a popular platform for hosting React apps.
- Install Netlify CLI (optional):
npm install netlify-cli -g - Run
npm run build - Drag and drop the
build/folder into Netlify dashboard - Or use
netlify deploycommand
⚡ Deploying to Vercel
Vercel is another popular option.
- Install Vercel CLI:
npm install -g vercel - Run
vercelin the project folder - Follow the instructions and your app will be live
📁 Deploying to GitHub Pages
GitHub Pages can host React apps for free.
- Install package:
npm install gh-pages --save-dev - Add
"homepage": "https://username.github.io/repo-name"inpackage.json - Add scripts:
"predeploy": "npm run build", "deploy": "gh-pages -d build" - Run
npm run deploy
🖥️ Deploying on Traditional Web Server
You can also deploy the build/ folder to Apache, Nginx, or any hosting provider.
Just copy the build/ folder contents into your server's public_html or www directory.
🧠 Test Your Knowledge
4 QuestionsProgress: 0 / 4
Keep Going!Course Complete!