How to achieve type safety and input validation in Next.js Server Actions? In this video I'll show you how! We'll use a package called ZSA to create Server Actions that validate their input using Zod, and we'll reuse the validation on the client side as well using React Hook Form. This is a really nice way to clean up your code and share validation logic between multiple server actions.
🔗 Links:
👉 ZSA docs: zsa.vercel.app/
👉 Zod docs: zod.dev/
--
🤝 Become a friend of the channel! Start your membership today and get extra benefits: youtube.com/channel/UCTexaJMnN_Pv6TVueQ61-oQ/join
💬 A bunch of us are hanging out at discord.creatures.sh/. Join us!
🐦 Find me on the bird app: twitter.com/NikolovLazar
🎥 What I use for coding and making videos: nikolovlazar.com/uses
Chapters:
00:00 - Intro
00:18 - Defining Procedures
02:02 - Defining Actions with Input Validation
04:19 - Invoking Actions from the Client
07:26 - Chaining Procedures
10:35 - Docs
11:21
コメント