import React, { useState } from 'react' import { Head, router } from '@inertiajs/react' import CustomerLayout from '@/Layouts/CustomerLayout' export default function Index({ auth: { user }, poins: { data, next_page_url }, }) { const [_poins, setpoins] = useState(data) const handleNextPage = () => { router.get( next_page_url, {}, { replace: true, preserveState: true, only: ['poins'], onSuccess: (res) => { setpoins(_poins.concat(res.props.poins.data)) }, } ) } return (
{user.fullname}
poin
{user.display_poin}
{_poins.map((poin) => (
router.get( route('customer.poin.show', poin.id) ) } >
{poin.format_human_created_at}
{poin.description}
{poin.amount}
))} {next_page_url !== null && (
Load more
)}
) }