This project is a Mini Shopping Cart built with React.
It demonstrates core React concepts including:
- Props — passing data and functions between components
- State management — using
useStateto manage cart items - Event handling — adding and removing items from the cart
- Component structure — breaking the app into reusable components
- Dynamic rendering — displaying products and updating the UI in response to user actions
This project was built as part of the Phase 2 React Code Challenge to showcase understanding of React fundamentals, code efficiency, and UI rendering.
- View a list of products with images, names, and prices in Ksh
- Add products to the cart with a single click
- Remove products from the cart
- Dynamic cart counter in the navigation bar
- Live total price calculation
- Clean and responsive layout using simple CSS
- App.jsx — main container and state manager
- NavBar.jsx — shows the app title and current cart count
- ProductList.jsx — displays all products
- ProductCard.jsx — individual product with “Add to Cart” button
- Cart.jsx — displays all items in the cart with total price
- CartItem.jsx — single cart item with remove button
Data flow:
Appholds the cart state.Apppasses props (cartCount,products,addToCart,removeFromCart) to child components.- Events (like adding/removing items) bubble up through props functions to update the state in
App.
-
Clone the repository
git clone https://github.com/Hillary90/Mini-Cart-React.git cd Mini-Cart-React/ -
Install dependencies
npm install
-
Run the app
npm run dev
-
Open your browser at the URL provided by Vite (usually http://localhost:3000).
- Add quantity selection for each cart item
- Add search or filter for products
- Use Tailwind CSS for a modern, responsive design
Hillary Tanui
