import React, {useState} from 'react' import PaginatedList from '../../Pagination/PaginatedList'; import {handlePagingFunc} from '../../Pagination/HandlePagination'; function ReferralTable({history}) { const [currentPage, setCurrentPage] = useState(0); const indexOfFirstItem = Number(currentPage); const indexOfLastItem = Number(indexOfFirstItem)+Number(process.env.REACT_APP_ITEM_PER_PAGE); const currentReferral = history?.data?.slice(indexOfFirstItem, indexOfLastItem); const handlePagination = (e) => { handlePagingFunc(e,setCurrentPage) } return (
{history.data.length ? currentReferral.map((item, index) => ( )) : ( history.error ? : ( ) ) }
Added/Name Email Status
{item.added_date} / {item.firstname} {item.lastname} {item.email} {item.status}
Opps! couldn't get referral history. Try reloading the page
No Item Found on referral List
{/* PAGINATION BUTTON */} = history?.data?.length ? true : false} data={history?.data} start={indexOfFirstItem} stop={indexOfLastItem} /> {/* END OF PAGINATION BUTTON */}
) } export default ReferralTable