zod for email validation

Solution retrospective
Use zod to validate email input
const emailSchema = z.string().email(); function isEmailValid(email: string) { return emailSchema.safeParse(email); } const { success } = isEmailValid(email); if (!success) { showEmailErrorMsg(); } else { closeEmailErrorMsg(); }
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Zup's solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord