A React application for displaying products from the FakeStore API. Practice using useEffect and useState hooks!
Complete the useEffect hooks in two files to fetch and display products:
- Home.jsx - Fetch all products and display them
- Details.jsx - Fetch a single product's details
Complete the useEffect hook to fetch products:
// API endpoint: 'https://fakestoreapi.com/products'
API Response:
- Returns an array of products directly (use
response.data)
Complete the useEffect hook to fetch a single product:
// API endpoint: https://fakestoreapi.com/products/${productId}
-
useEffectimplemented inHome.jsx -
useEffectimplemented inDetails.jsx - Products display on home page
- Product details display on details page
- Search functionality works
- Filter by category works
- Loading states work
- Error handling works
- Base URL:
https://fakestoreapi.com - All Products:
GET /products - Single Product:
GET /products/{id}
No API key required! 🎉
Good luck! 🚀