← React.js learning pathReact.js · Module 10 of 10
Building and deploying React apps
Structure, test and ship a React app to production.
📖 Key ideas
- Organise by feature: components, pages, hooks, services.
- npm run build creates optimised static files in dist/.
- Deploy static builds to Vercel, Netlify or Firebase Hosting.
- Environment variables (VITE_API_URL) configure builds; never put secrets in front-end code.
- 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