正在加载视频...

视频加载失败

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 次观看 • 2 年前 •via X (Twitter)

8 条评论

Bilal 的头像
Bilal2 年前

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

Fredkisss is on 🦋 blue sky 🦋 的头像
Fredkisss is on 🦋 blue sky 🦋2 年前

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

Danny Guerin 的头像
Danny Guerin2 年前

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 的头像
Christoph2 年前

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 的头像
Michał Miszczyszyn @ yournextstore.com2 年前

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

Fabian Hiller 的头像
Fabian Hiller2 年前

🙌

Isaiah Marc Sanchez 的头像
Isaiah Marc Sanchez2 年前

I do this with tRPC, React Hook Form and Zod

Abhinav Bhar 的头像
Abhinav Bhar2 年前

You can just make it a npm package and do it

相关视频