Created
July 6, 2020 16:57
-
-
Save maisonm/58e02a5060ade8d154251ecd93c05cf7 to your computer and use it in GitHub Desktop.
Rendering page numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pageNumberRender = () => { | |
const { totalPages, currentClickedNumber } = this.state; | |
let pages = []; | |
for (let i = 1; i < totalPages + 1; i++) { | |
pages.push( | |
<PageNumber | |
onClick={(e) => { | |
this.setCurrentClickedNumber(e); | |
}} | |
isClicked={currentClickedNumber === i ? true : false} | |
key={i} | |
> | |
{i} | |
</PageNumber> | |
); | |
} | |
return pages; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment