This commit is contained in:
Delba de Oliveira
2023-10-26 09:31:34 -07:00
parent 55dde02de3
commit a2b464d837
2 changed files with 7 additions and 1 deletions

View File

@@ -10,10 +10,14 @@ import {
} from '@heroicons/react/24/outline';
import { Button } from '../button';
import { createInvoice } from '@/app/lib/actions';
import { experimental_useFormState as useFormState } from 'react-dom';
export default function Form({ customers }: { customers: CustomerField[] }) {
const initialState = { message: null, errors: [] };
const [state, dispatch] = useFormState(createInvoice, initialState);
return (
<form>
<form action={dispatch}>
<div className="rounded-md bg-gray-50 p-4 md:p-6">
{/* Customer Name */}
<div className="mb-4">

View File

@@ -31,6 +31,7 @@ export default async function InvoicesTable({
className="mr-2 rounded-full"
width={28}
height={28}
alt={`${invoice.name}'s profile picture`}
/>
<p>{invoice.name}</p>
</div>
@@ -89,6 +90,7 @@ export default async function InvoicesTable({
className="rounded-full"
width={28}
height={28}
alt={`${invoice.name}'s profile picture`}
/>
<p>{invoice.name}</p>
</div>