Part 01 / Topic 3 of 8
Reading what Vite gave you
A fresh scaffold has five files worth actually reading before you touch any of them:
| File | What it is for |
|---|---|
index.html |
The one real HTML page. It has an empty <div id="root"></div> and a <script type="module" src="/src/main.jsx"> - everything you see on screen is injected into that one div by JavaScript. |
src/main.jsx |
The entry point. Calls createRoot(document.getElementById("root")).render(<App />) - this is the one place your component tree is handed to the real DOM. |
src/App.jsx |
Your first component. Everything else you build is either rendered inside it or imported by something that is. |
package.json |
npm run dev starts Vite's dev server; npm run build produces a production bundle in dist/; npm run preview serves that production bundle locally so you can sanity-check it before deploying. |
vite.config.js |
Tells Vite to use @vitejs/plugin-react, the plugin that understands JSX and gives you fast-refresh (section 7 touches why the plugin matters). |
Compare index.html to a page you might have written before React: there is no markup for your actual UI in it at all. That absence is the whole model - the HTML file's only job is to give React a place to mount into.
Done here? The practice set for Part 1 — including the solutions — is on the part page.