Module 31: Introduction to React

Lesson 2 of 5 · 15–25 minutes

Setting up with Vite

🏠The everyday picture

A ready-made kitchen kit: stove, utensils and spice rack already arranged, so you start cooking straight away instead of building cupboards.

📘What it really is

npm create vite@latest enquiries -- --template react-ts
cd enquiries
npm install
npm run dev

Open the address it shows (usually http://localhost:5173). Edit a file and save: the page updates instantly.

🖱️Try it

Create the enquiries project, run it, and open it in the browser. Change the text in App.tsx, save, and watch the page update. Commit the starting point.

✅Quick check

What's the difference between npm run dev and npm run build?

Show the answer

dev runs a live development server on your computer; build creates optimised files for hosting.

Your React page is blank and the console shows an error. Where do you look first?

Show the answer

The browser console and the terminal running npm run dev; both show errors.

← PreviousWhy React exists
ProLearners Assist