import React, { useState } from 'react' import { Head, router } from '@inertiajs/react' import CustomerLayout from '@/Layouts/CustomerLayout' export default function Index({ query: { data, next_page_url } }) { const [sales, setSales] = useState(data) const handleNextPage = () => { router.get( next_page_url, {}, { replace: true, preserveState: true, only: ['query'], onSuccess: (res) => { setSales(sales.concat(res.props.query.data)) }, } ) } return (
Transaksi Pembelian
{sales.map((sale) => (
router.get( route('transactions.show', sale.id) ) } >
{sale.format_human_created_at}
Invoice{' '} #{sale.code}
{sale.display_amount}
))} {next_page_url !== null && (
Load more
)}
) }