Skip to content

Commit

Permalink
Merge pull request #316 from ixartz/disable-submitting
Browse files Browse the repository at this point in the history
feat: disable form submit button when submitting form
  • Loading branch information
ixartz committed Sep 14, 2024
2 parents df16c69 + 0247937 commit a4a6b7c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/CounterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const CounterForm = () => {
handleSubmit,
register,
reset,
formState: { errors },
formState: { errors, isSubmitting },
} = useForm<z.infer<typeof CounterValidation>>({
resolver: zodResolver(CounterValidation),
defaultValues: {
Expand Down Expand Up @@ -57,8 +57,9 @@ const CounterForm = () => {

<div className="mt-2">
<button
className="rounded bg-blue-500 px-5 py-1 font-bold text-white hover:bg-blue-600 focus:outline-none focus:ring focus:ring-blue-300/50"
className="rounded bg-blue-500 px-5 py-1 font-bold text-white hover:bg-blue-600 focus:outline-none focus:ring focus:ring-blue-300/50 disabled:pointer-events-none disabled:opacity-50"
type="submit"
disabled={isSubmitting}
>
{t('button_increment')}
</button>
Expand Down

0 comments on commit a4a6b7c

Please sign in to comment.