The pagination is working fine on local host npm run dev
but when i run nmp start it not showing the page numbers instead it show Previous next
in place of the page numbers.
This is how i am rendering the react paginate librabry
previousLabel={"previous"}
nextLabel={"next"}
breakLabel={"..."}
breakClassName={styles.pagination}
activeClassName={styles.active}
pageCount={pageCount}
marginPagesDisplayed={2}
pageRangeDisplayed={2}
containerClassName={styles.pagiCont}
onPageChange={handlePageClick}
pageClassName={styles.pagination}
pageLinkClassName={styles.paginationAtag}
previousClassName={styles.pagination}
previousLinkClassName={styles.paginationHead}
nextClassName={styles.paginationHead}
nextLinkClassName={styles.paginationHead}
breakLinkClassName={styles.pagination}
renderOnZeroPageCount={null}
/>
This is the handle click function that i am using
const handlePageClick = async (event) => {
setPage(event.selected + 1);
try {
const response = await fetch(
`${BaseURL}/get-listings/?currency_accepted=${currencyFrom}¤cy_payout=${currencyTo}&available_liquidity=${availableLiquidity}&payout_option=${payoutOption}&payin_option=${payinOption}&page_size=10&page=${
event.selected + 1
}&rate_sort=${sortByPrice}`,
{
method: "GET",
}
);
const resData = await response.json();
const PassData = resData.results;
if (PassData.length < 1) {
toast.warn("No data available for this Search ");
}
setData(PassData);
setNoOfRecords(resData.count);
} catch (error) {
console.error(error);
}
};