Pagination
Build a React component called Pagination that displays a list of products fetched from a remote API. The products should be displayed in a paginated format, with 10 items per page and navigational buttons to go to the previous and next pages.
Requirements:
-
Fetch products from this API endpoint:
https://dummyjson.com/products?limit=200 -
Display 10 products per page with:
- Thumbnail image
- Title
-
Include pagination controls:
- A Previous button with id="previous" to navigate to the previous page. It should be disabled on the first page.
- A Next button with id="next" to navigate to the next page. It should be disabled on the last page.
- Buttons for each page number (1-20) (highlight the active one)
-
Clicking "Next" should go to the next page.
Clicking "Previous" should go to the previous page.
Clicking a page number (1-20) should directly load that page. -
Show
"No products found"mesage if the product list is empty.
Additional Notes:
- You must use
useStateanduseEffect. - Do not use any third-party pagination libraries.
- Use functional components only.
- You may use
react-icons,FiChevronsLeftfor left arrow icon andFiChevronsLeftfor right arrow icon (optional) .
Reference UI

Companies:
Solve Similar questions 🔥
Want to upskill? Explore our courses!
Namaste DSA
Master DSA from scratch with numerous problems, and expert guidance.
Namaste React
Wanna dive deep into React and become Frontend Expert? Learn with me now!
Namaste Frontend System Design
The most comprehensive and detailed course for frontend system design.
Namaste Node.js
Wanna dive deep into Node.js? Enroll into `Namaste Node.js` now!
