"use client"; import { useFormState, useFormStatus } from "react-dom"; import { Alert, AlertDescription } from "@/components/ui/alert"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { atualizarConta, type ContaState } from "./actions"; type Props = { cliente: { nomeCompleto: string; whatsapp: string; razaoSocial: string | null; cep: string | null; logradouro: string | null; numero: string | null; complemento: string | null; bairro: string | null; cidade: string | null; uf: string | null; }; }; const initialState: ContaState = { ok: false }; function SubmitButton() { const { pending } = useFormStatus(); return ; } export function ContaForm({ cliente }: Props) { const [state, action] = useFormState(atualizarConta, initialState); return (
{state.message ? ( {state.message} ) : null}
); }