done#1519
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because one core requirement of the task is not implemented yet: synchronizing pagination state with the URL using React Router. Your App.tsx currently manages currentPage and perPage only via useState, and the URL never reflects these values (e.g. no ?page=2&perPage=7), nor are query parameters read on initial load. This is a functional requirement, not just a nice-to-have, so without it the task is considered incomplete.
To fix this, you should:
- Wrap your application in a router (e.g.
BrowserRouterinmain.tsxorindex.tsx). - In
App.tsx, use React Router hooks such asuseSearchParams(oruseLocation+useNavigate) to:- Initialize
currentPageandperPagefrom thepageandperPagequery parameters (with sensible numeric defaults when they are missing or invalid). - Update those query parameters whenever
currentPageorperPagechanges (and ensure changingperPagestill resets the page to 1).
Everything else about your pagination component and UI behavior looks solid, so once you add the URL syncing with React Router, your solution should meet all the requirements. Keep going—you’re very close to a complete and robust implementation.
- Initialize
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because, although your implementation meets the functional and routing requirements of the task, there are still CI failures that are considered blocking for this assignment. Functionally, your Pagination component and App correctly implement stateless pagination, URL synchronization via React Router, proper data-cy usage, and accurate page/item calculations, so the core checklist items are satisfied. However, ESLint reports two issues in src/App.tsx: an unused variable totalPages (around line 17), and a label without an associated control (around line 55), which violates the accessibility rule jsx-a11y/label-has-associated-control. These must be fixed by either using or removing totalPages, and by adding a matching id on the select and htmlFor on the label. Once you address these linter errors, your solution should be in good shape to pass all required checks; you’ve done solid work on the main behavior, and this is mainly about cleaning up the remaining tooling issues.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution as an educational override so you can keep progressing while learning. You’ve done a strong job making Pagination stateless, wiring it to React Router via useSearchParams, preserving the required HTML structure and data-cy attributes, and correctly implementing the info line and per-page selector according to the task requirements. One remaining issue is that in src/components/Pagination/Pagination.tsx your Props type still requires currentPage, while the checklist specifies it should be optional and default to 1 when omitted [CHECKLIST ITEM #20]; you can fix this by declaring currentPage?: number and using a default value in the component destructuring (e.g. const { total, perPage, currentPage = 1, onPageChange } = props). Aside from that, your use of li.active/li.disabled, aria-disabled="true", and proper onPageChange behavior shows good attention to both functionality and accessibility. Overall, you’ve addressed the previous review points well, and this last type/detail tweak will help make your solution fully aligned with the specification. Keep up the good work—this is very solid progress for a routing + pagination task.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| import { getNumbers } from './utils'; | ||
| import { useSearchParams } from 'react-router-dom'; | ||
| import Pagination from './components/Pagination/Pagination'; | ||
|
|
There was a problem hiding this comment.
etojeDenys
left a comment
There was a problem hiding this comment.
demo link does not work. please fix it and request the review again
brespect
left a comment
There was a problem hiding this comment.
Good progress, but you DEMO LINK is not working. Also, don't forget to pass all tests before requesting the review
Denys-Kravchuk9988
left a comment
There was a problem hiding this comment.
Good job!
A few things to improve:
| return ( | ||
| <ul className="pagination"> | ||
| {/* PREV */} | ||
| <li className={`page-item ${currentPage === 1 ? 'disabled' : ''}`}> |
There was a problem hiding this comment.
It's better to use classNames here
| {pages.map(page => ( | ||
| <li | ||
| key={page} | ||
| className={`page-item ${currentPage === page ? 'active' : ''}`} |
There was a problem hiding this comment.
It's better to use classNames here
|
|
||
| {/* NEXT */} | ||
| <li | ||
| className={`page-item ${currentPage === totalPages ? 'disabled' : ''}`} |
There was a problem hiding this comment.
It's better to use classNames here
DEMO - https://misulkin.github.io/react_pagination/