mirror of
https://github.com/vercel/next-learn.git
synced 2026-06-11 09:51:47 +00:00
Add index to key for uniqueness (#640)
Using only the page as a key does not preserve uniqueness across updates. This caused, for example, an ellipsis to appear before the pagination elements when navigating from a page in the middle back to the first page.
This commit is contained in:
@@ -38,7 +38,7 @@ export default function Pagination({ totalPages }: { totalPages: number }) {
|
||||
|
||||
return (
|
||||
<PaginationNumber
|
||||
key={page}
|
||||
key={`${page}-${index}`}
|
||||
href={createPageURL(page)}
|
||||
page={page}
|
||||
position={position}
|
||||
|
||||
Reference in New Issue
Block a user