Start a React project

Development and production builds

Use the fast development server while editing and create optimized static assets before deployment.

npm run dev starts the development server. It favors fast feedback, source maps, and useful warnings while you edit.

Development behavior is not the deployed application. The build may reveal an import that differs only by filename case, a missing environment value, or code that cannot be bundled.

Create the production assets with:

npm run build

Then inspect them locally:

npm run preview

The preview command serves the built files. It does not recreate your real hosting platform, so test routing, headers, and server features in the deployed environment too.

React can also do extra development work. Strict Mode may render components or rerun Effects to expose impure code and missing cleanup. Do not “fix” that by depending on production running fewer checks. Fix the component so repeating the setup is safe.

Before publishing, run the build, open the preview, check the browser console, and test one critical interaction. A page working in an already-open development tab is not enough evidence.

Lesson completed

Take this course offline

Get every free book, course edition, and software download.

Get the download library →