From e0d3dd0331dc48045225eaa15d772d99ab55f1f1 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Tue, 16 Jul 2024 13:27:58 -0700 Subject: [PATCH] Further simplified --- Client/src/Components/BasicTable/index.jsx | 51 +++++++--------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/Client/src/Components/BasicTable/index.jsx b/Client/src/Components/BasicTable/index.jsx index 705872033..f006a3a48 100644 --- a/Client/src/Components/BasicTable/index.jsx +++ b/Client/src/Components/BasicTable/index.jsx @@ -77,13 +77,9 @@ const BasicTable = ({ data, paginated }) => { setPage(0); // Reset to first page after changing rows per page }; - let paginatedData = []; - if (paginated) { - paginatedData = data.rows.slice( - page * rowsPerPage, - page * rowsPerPage + rowsPerPage - ); - } + let displayData = paginated + ? data.rows.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) + : data.rows; return ( <> @@ -97,34 +93,19 @@ const BasicTable = ({ data, paginated }) => { - {paginated === false && - data.rows.map((row) => { - return ( - - {row.data.map((cell) => { - return {cell.data}; - })} - - ); - })} - {paginated === true && - paginatedData.map((row) => { - return ( - - {row.data.map((cell) => { - return {cell.data}; - })} - - ); - })} + {displayData.map((row) => { + return ( + + {row.data.map((cell) => { + return {cell.data}; + })} + + ); + })}