A simple fake shopping page featuring pagination, API integration, and a shopping basket. This project is a step into learning React, state management, and interacting with APIs. Although it’s an older project, it showcases a variety of useful concepts for building modern web applications.
- 🛟️ Product List: Fetches dessert data from TheMealDB API and displays them with pagination.
- 🔄 Pagination: Dynamically handles large product lists with page navigation.
- 🛒 Basket:
- Add/remove products.
- Update product quantity.
- Calculate total price.
- 🔍 Hover Tooltips: Display product details on hover (for larger screens).
- 🌐 Responsive Design: Works across devices.
- 🛠️ Modular Code: Organized with components and reusable functions.
project-root
├── src
│ ├── components
│ │ ├── Navigation.jsx
│ │ ├── Products.jsx
│ │ ├── Footer.jsx
│ ├── pages
│ │ ├── Home.jsx
│ │ ├── Basket.jsx
│ │ ├── OneProduct.jsx
│ ├── functions
│ │ ├── fetchProducts.js
│ │ ├── hoverDetails.js
│ ├── App.jsx
│ ├── index.css
├── public
│ ├── logo.png
├── package.json
- Frontend:
- ⚛️ React.js
- 🚤 React Router for navigation
- 💅 Framer Motion for animations
- 🔛 React Paginate for pagination
- Backend API:
- Storage:
- 🛒 Basket stored in
localStorage
- 🛒 Basket stored in
- Icons:
- React Icons for visual enhancement
- Node.js and npm installed on your system.
-
Clone the repository:
git clone <repository-url> cd project-root
-
Install dependencies:
npm install
-
Start the development server:
npm start
-
Open your browser and visit
http://localhost:5174.
-
Home:
- Displays products fetched from TheMealDB API.
- Includes pagination for navigation.
- Hover on products to see tooltips with details like ingredients and price.
-
Basket:
- Lists products added to the basket.
- Allows updating quantity or removing items.
- Displays the total price.
-
404 Page:
- Renders a fallback for invalid URLs.
Fetches dessert data from the API:
const desserts = response.data.meals.slice(0, 50).map(dessert => ({
...dessert,
price: (Math.random() * 10 + 5).toFixed(2),
}));Displays a tooltip with product details:
- Ingredients
- Category
- Area
- Price
- Visit the Home Page to browse products.
- Hover over products to see details.
- Add items to your basket by clicking the basket icon.
- Navigate to the Basket Page to manage items and check your total.
- Add user authentication for personalized baskets.
- Implement a real backend for storing products and orders.
- Refactor for improved code modularity.
- Deploy the application for live use.
This project was a great opportunity to explore React features like state management, routing, and modular components while experimenting with APIs. 🎉


