How to deploy a React app to Netlify
Deploying React applications requires a hosting platform that supports static files, provides HTTPS, and handles client-side routing properly. As the creator of CoreUI with over 12 years of React experience since 2014, I’ve deployed numerous production applications to various hosting platforms. Netlify is a popular choice for React apps offering automatic builds from Git, instant rollbacks, and built-in CDN with zero configuration. The deployment process connects your Git repository to Netlify for automatic deployments on every push.
Connect your Git repository to Netlify for automatic deployment with continuous integration.
Method 1: Deploy via Netlify Dashboard
- Build your React app locally:
npm run build
-
Sign up at netlify.com
-
Click “Add new site” → “Import an existing project”
-
Connect your Git provider (GitHub, GitLab, Bitbucket)
-
Configure build settings:
- Build command:
npm run build - Publish directory:
build
- Build command:
-
Click “Deploy site”
Method 2: Deploy via Netlify CLI
# Install Netlify CLI
npm install -g netlify-cli
# Login to Netlify
netlify login
# Initialize and deploy
netlify init
# Or deploy manually
npm run build
netlify deploy --prod
Configure client-side routing - Create public/_redirects:
/* /index.html 200
Set environment variables in Netlify Dashboard:
- Site settings → Build & deploy → Environment → Edit variables
- Add variables like
REACT_APP_API_URL
Best Practice Note
The _redirects file ensures client-side routing works correctly by redirecting all routes to index.html. Netlify automatically provides HTTPS and a CDN. Use branch deploys for preview environments—each Git branch gets its own URL. Enable deploy previews for pull requests to test changes before merging. This is how we deploy CoreUI React templates—Git-based continuous deployment with automatic builds, preview URLs for testing, and instant production deployments.



