← React.js learning path
React.js · Module 10 of 10

Building and deploying React apps

Structure, test and ship a React app to production.

📖 Key ideas

  1. Organise by feature: components, pages, hooks, services.
  2. npm run build creates optimised static files in dist/.
  3. Deploy static builds to Vercel, Netlify or Firebase Hosting.
  4. Environment variables (VITE_API_URL) configure builds; never put secrets in front-end code.
  5. Test with Vitest/Jest and React Testing Library.
💡 Real-life example: Building is packing for a trip: fold everything small (minify) and leave behind what you don't need (tree-shaking).
npm run buildCreates production files
Tree-shakingRemoves unused code
React Testing LibraryTests components like a user
Environment variableConfig value set at build time