clear form on submit
This commit is contained in:
parent
29b09848b0
commit
533398cdb3
@ -22,20 +22,24 @@ export default function CreateCountryForm() {
|
||||
}
|
||||
}, [formState.message]);
|
||||
return (
|
||||
<form action={formAction} className="flex flex-col gap-2">
|
||||
<form ref={formRef} action={formAction} className="flex flex-col gap-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Input
|
||||
name="name"
|
||||
id="name"
|
||||
className={clsx({ "border-red-500": formState.errors?.name })}
|
||||
/>
|
||||
{formState.message === "success" ? (
|
||||
<Check className="text-green-400" />
|
||||
<Check className="text-green-500" />
|
||||
) : (
|
||||
<div className="flex items-center gap-2">
|
||||
<CircleX className="text-red-600" />
|
||||
<span>{formState.errors?.name}</span>{" "}
|
||||
</div>
|
||||
""
|
||||
)}
|
||||
{formState.message === "error" ? (
|
||||
<CircleX className="text-red-500" />
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</div>
|
||||
<SubmitButton text={"Country"} />
|
||||
</form>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user