Stage 2 · Lesson 3 of 8
A Vite React project and its dev server
creates and serves a React project. Run npm create vite@latest and pick React. Then npm run dev starts a that reloads instantly as you edit.
npm run build produces for . Learn what each generated file does. index.html is the , src/main.jsx starts the app, and everything it imports is bundled together for the browser.
Environment variables for the browser must start with VITE_ and are read with import.meta.env. They end up in the public code anyone can read, so never put a secret there. Your API usually runs on another port while you develop.
The browser treats that as another site and may block the call with a CORS error. The Vite proxy fixes this by forwarding /api requests to your backend for you. In production you configure CORS or serve both from one address, which later stages cover.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- GuideFreeReact Documentation
Meta
Free official course; Thinking in React and Managing State matter most
- CourseFreeFull Stack Open
University of Helsinki · Intermediate
Free: Parts 0 to 2 cover web basics, React and talking to a server