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: https://zsa.vercel.app
👉 Zod docs: https://zod.dev
--
🤝 Become a friend of the channel! Start your membership today and get extra benefits: / @nikolovlazar
💬 A bunch of us are hanging out at https://discord.creatures.sh/. Join us!
🐦 Find me on the bird app: / nikolovlazar
🎥 What I use for coding and making videos: https://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 - Outro