Today's Plan
8 April 2026 · From Scratch to Components
Today's Plan
Before We Code
git pull origin mainLive Demo
Run these commands in order.
# 1. Create a new Vite React project npm create vite@latest my-shop -- --template react # 2. Enter the project folder cd my-shop # 3. Install dependencies npm install # 4. Install Tailwind CSS v4 for Vite npm install tailwindcss @tailwindcss/vite # 5. Add the Tailwind Vite plugin in vite.config.js # Then add this to src/index.css: # @import "tailwindcss"; # 6. Start the dev server npm run dev
💡 vite.config.js is still needed for the Tailwind Vite plugin. tailwind.config.js is usually not needed in Tailwind v4.
Design First
Sketch or draft an outline of the website.
Think in [blocks] → map those to React Components. Every box you draw on paper becomes a <Component />.
HTML Structure → React Components
src/components/Header.jsxsrc/components/ProductCard.jsxMilestone 2 Status
💡 Personalise: add your own colours, product data, or a WishlistButton. Make it yours!
Good Question!
App.jsxApp.jsx💡 The App.jsx code is very similar in M2 and M3 because both milestones apply local state management at the top level and pass data down via props.
Future Milestone — Context
// src/context/CartContext.jsx ← new file import { createContext, useContext, useState } from "react"; const CartContext = createContext(); // Provider wraps the whole app — holds state here export function CartProvider({ children }) { const [cart, setCart] = useState([]); const addToCart = (product) => setCart((prev) => [...prev, product]); return ( <CartContext.Provider value={{ cart, addToCart }}> {children} </CartContext.Provider> ); } // Custom hook — any component can call this export const useCart = () => useContext(CartContext);
Then in main.jsx: wrap <App /> with <CartProvider>. Now every component can call useCart() directly — no props needed.
You all have the same base project. Now diverge. Add your own touches — that's where learning becomes real.
We'll share work in breakout rooms — show your peers what you built 👀
Ask questions. Break things. Fix them. That's exactly how this works.