Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

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 Aufrufe • vor 2 Jahren •via X (Twitter)

8 Kommentare

Profilbild von Bilal
Bilalvor 2 Jahren

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

Profilbild von Fredkisss is on 🦋 blue sky 🦋
Fredkisss is on 🦋 blue sky 🦋vor 2 Jahren

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

Profilbild von Danny Guerin
Danny Guerinvor 2 Jahren

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.

Profilbild von Christoph
Christophvor 2 Jahren

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

Profilbild von Michał Miszczyszyn @ yournextstore.com
Michał Miszczyszyn @ yournextstore.comvor 2 Jahren

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

Profilbild von Fabian Hiller
Fabian Hillervor 2 Jahren

🙌

Profilbild von Isaiah Marc Sanchez
Isaiah Marc Sanchezvor 2 Jahren

I do this with tRPC, React Hook Form and Zod

Profilbild von Abhinav Bhar
Abhinav Bharvor 2 Jahren

You can just make it a npm package and do it

Ähnliche Videos