Loading video...

Video Failed to Load

Go Home

Form validation is hard. What if there was a Next.js form lib that does both client and server validation from one Zod schema 👀

145,943 views • 2 years ago •via X (Twitter)

8 Comments

Bilal's profile picture
Bilal2 years ago

I like the react-hook-form flow Shadcn uses. Just the client though which I think is fine.

Fredkisss is on 🦋 blue sky 🦋's profile picture
Fredkisss is on 🦋 blue sky 🦋2 years ago

This resembles the new tanstack form, pretty sure it works on both environments exactly like that cc @crutchcorn

Danny Guerin's profile picture
Danny Guerin2 years ago

I guess I'm just the weird person that really, genuinely loves writing form validation from scratch. Like, it is fun to me. Please give me more forms to validate.

Christoph's profile picture
Christoph2 years ago

What if you need the check the db in the validation for the server only? For example to check if the selected user exists when sending the id

Michał Miszczyszyn @ yournextstore.com's profile picture
Michał Miszczyszyn @ yournextstore.com2 years ago

There is such library: it's called next-safe-action!

Fabian Hiller's profile picture
Fabian Hiller2 years ago

🙌

Isaiah Marc Sanchez's profile picture
Isaiah Marc Sanchez2 years ago

I do this with tRPC, React Hook Form and Zod

Abhinav Bhar's profile picture
Abhinav Bhar2 years ago

You can just make it a npm package and do it

Related Videos