Skip to content

Commit 2d872c4

Browse files
author
WebDeveloperGuide
committed
Products List > Pagination > Handled dynamically. Hide pagination if lower records.
1 parent b0ac1aa commit 2d872c4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

web_admin/src/components/pages/product/Products.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const Products = () => {
1616
const { loading, error, products, numOfPages } = productList;
1717

1818
let pageNum = 0;
19-
let productsPerPage = 1;
19+
let productsPerPage = 10;
2020
const handlePageClick = (data) => {
2121
pageNum = data.selected;
2222
dispatch(listProducts(pageNum,productsPerPage));
@@ -62,10 +62,8 @@ const Products = () => {
6262
</tbody>
6363
</table>
6464
</div>
65-
<div className="mt-4">
66-
{
67-
68-
<ReactPaginate
65+
<div className={ 'mt-4' + (numOfPages ? '' : ' d-none')}>
66+
<ReactPaginate
6967
previousLabel={"Previous"}
7068
nextLabel={"Next"}
7169
breakLabel={"..."}
@@ -83,9 +81,7 @@ const Products = () => {
8381
breakClassName={"page-item"}
8482
breakLinkClassName={"page-link"}
8583
activeClassName={"active"}
86-
/>
87-
}
88-
84+
/>
8985
</div>
9086
</div>
9187
</div>

0 commit comments

Comments
 (0)