Refactor contact form validation to use useDebounce for improved performance and streamline error handling. Simplify error retrieval logic and ensure touched state is updated on input changes.

This commit is contained in:
jake committed 2025-09-02 19:10:56 -04:00
1 parent 20d8aad41f
commit b06e7bbf4d
3 files changed
+29 -15

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
import { z } from "zod";
export const ContactSchema = z
.object({
name: z.string().trim().min(1, { message: "Your name is required." }),
email: z.string().email({ message: "Your email address is required." }),
message: z.string().trim().min(15, { message: "Your message must be at least 15 characters." }),
})
.readonly();
export type ContactInput = z.infer<typeof ContactSchema>;