A small e-commerce front end built with React and Vite. Browse products, add them to a cart, adjust quantities, and check the running total — all client-side, backed by a public product API.
- Home — landing page with a call to action into the shop
- Shop — product grid fetched live from Fake Store API, each card with quantity controls and an add-to-cart button
- Cart — running list of added items with per-item quantity adjustment, removal, and a computed total
- Navbar — persistent navigation with a live cart item count badge
- React (Vite)
- React Router (
react-router-dom) for client-side routing - Plain CSS — no UI framework
- Fake Store API for product data
src/
├── components/
│ ├── Navbar.jsx
│ └── ProductCard.jsx
├── pages/
│ ├── Home.jsx
│ ├── Shop.jsx
│ └── Cart.jsx
├── App.jsx
├── App.css
└── main.jsx
- Cart state lives in
App.jsxand is passed down as props.handleAddToCart,handleUpdateQuantity, andhandleRemoveItemare the single source of truth for cart mutations — child components only call these handlers, they don't mutate cart state directly. ProductCardmanages its own localquantitystate for the "how many to add" selector, separate from the cart's per-item quantity.- Routing is handled with
react-router-dom'sRoutes/Route, wrapped inBrowserRouterat themain.jsxentry point. - Styling is a single flat, monochrome stylesheet (
App.css) — no CSS modules, no component-scoped styles.
npm install
npm run dev