import React, {useState} from 'react' import PaginatedList from '../../Pagination/PaginatedList'; import { handlePagingFunc } from '../../Pagination/HandlePagination'; function PurchasesTable({purchase}) { const [currentPage, setCurrentPage] = useState(0); const indexOfFirstItem = Number(currentPage); const indexOfLastItem = Number(indexOfFirstItem)+Number(process.env.REACT_APP_ITEM_PER_PAGE); const currentPurchase = purchase?.data?.slice(indexOfFirstItem, indexOfLastItem); const handlePagination = (e) => { handlePagingFunc(e,setCurrentPage) } return (
{purchase.data.length ? ( {currentPurchase.map((item, index) => ( ))} ) : purchase.error ? ( ) : }
Trx. Amount Fee
{item.added_date}
{item.confirmation}
{item.amount} {item.fee}
Opps! an error occurred. Please try again!
No Purchase History Found!
{/* PAGINATION BUTTON */} = purchase?.data?.length ? true : false} data={purchase?.data} start={indexOfFirstItem} stop={indexOfLastItem} /> {/* END OF PAGINATION BUTTON */}
) } export default PurchasesTable