October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Deploy a React App in 6 Steps

Deploying a React app starts with matching its build tool to the host’s build command and output folder. Then configure routes and public environment values, deploy, and test the live site.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To deploy a React app, create its production build, publish that build with a host, configure client-side routes and public environment variables, then test the live site. The exact build command and output folder depend on how the project was created: a Vite app and a Create React App project do not use identical settings.

1. Identify your app’s build setup

Open the project’s package.json and check its scripts and dependencies. The build tool determines which command to run and which directory to publish; “React app” alone is not enough to identify either.

  • Vite: The production build command is vite build. Vite’s default output directory is commonly dist, though project configuration can change it. See Vite’s production build guide.
  • Create React App: Netlify’s documented setup uses react-scripts build and the build folder as the suggested publish directory. See Netlify’s React guide.

If your project uses another framework or has customized scripts, follow its configuration rather than copying either example.

2. Create and inspect the production build

Run the production build command from the project directory. For Vite, that is npm run build when the package script maps to vite build; for the documented Create React App setup, the script typically runs react-scripts build. Vite’s guide puts it simply: “When it is time to deploy your app for production, simply run the vite build command.”

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Wait for the command to finish successfully, then check that the expected output folder exists and contains the built site files. If the build fails, resolve the reported errors before configuring a host; a successful development server run does not establish that the production build works.

3. Choose and connect a host

A typical Vite production build is suitable for static hosting. The Vite static deployment guide documents deployment options including Netlify and Vercel, with Git-based and command-line workflows. Netlify also documents connecting a repository or deploying through its CLI in its React setup guide.

For a Git-connected workflow, link the repository and choose which branch represents production. This can automate deployments when that branch changes; preview deployments may also be available for other branches, depending on the provider’s configuration. Before choosing, check how the host detects your framework, how you set the publish directory and route fallback, and how it handles production and preview builds. The cited setup guides do not establish current prices, quotas, or service guarantees, so check provider terms directly if those affect your decision.

4. Match the host’s build and publish settings

In the host’s project settings, make sure the build command and publish directory match your app. These are different for common setups:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Project setup Build command Publish directory
Vite, default output vite build (often run through the project’s build script) dist by default; project configuration can change it. Vite
Create React App on Netlify, as documented react-scripts build build. Netlify

Do not use a framework’s settings just because another React project uses them. If the app is in a subdirectory of a larger repository or has a customized output folder, configure the host to build the correct project and publish the folder the build actually produces.

5. Configure routes and environment values

Make client-side routes work on direct visits

Many single-page React apps use browser history for routes. A visitor who opens a nested URL directly—or refreshes while on one—may get a 404 if the host looks for a matching file instead of serving the app. Configure a fallback rewrite so application routes serve index.html, using the host’s instructions for single-page apps. The Create React App deployment documentation covers this routing issue.

Set build-time environment values safely

Add required environment values in the host’s build or project settings, following the conventions for the app’s framework. On Netlify, Create React App variables use the REACT_APP_ prefix, and framework variables intended for client-side code become available in browser JavaScript. That means visitors can inspect them: do not put passwords, private API keys, or other secrets in client-side variables. See Netlify’s framework environment-variable guidance and its React guide.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Deploy and verify the live app

Trigger a deployment through the connected Git workflow or the host’s CLI. When it finishes, open the production URL and check the behavior that matters to users:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Load the home page and verify that styling, images, scripts, and other assets appear correctly.
  • Open important app flows and confirm that any environment-dependent behavior works.
  • If the app has client-side routes, paste a nested route into the address bar and refresh it; both should load without a 404.
  • Check the deployment log if the site is blank, assets are missing, or a route fails. Confirm the build command, publish directory, fallback rule, and configured environment values against the project.

Vite’s production guide lists Chrome 111+, Edge 111+, Firefox 114+, and Safari 16.4+ as its default browser target range. Those are Vite defaults, not a guarantee that a particular app or its dependencies work in every listed browser; project build configuration can change the target. If browser compatibility matters, test the actual app on the browsers your users need.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.