Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const renderPageButtons = (
currentPage,
totalPageCount,
onCurrentPageChange,
) => {
const pageButtons = [];
const maxButtonCount = 3;
let startPage = 1;
let endPage = totalPageCount || 1;
if (maxButtonCount < totalPageCount) {
startPage = calculateStartPage(currentPage + 1, maxButtonCount, totalPageCount);
endPage = (startPage + maxButtonCount) - 1;
}
if (startPage > 1) {
pageButtons.push((
onCurrentPageChange(0)}
/>
));
if (startPage > 2) {
pageButtons.push((