BELL
BELL13mo ago

Using react-hook form, zod, & convex together

Hi all, does anyone know of a good article/tutorial on using react-hook form, zod, & convex together? Most of the stuff i've seen online is for smaller inserts/creates using convex (eg: create TODO, Thumbnail, etc) I am wanting to use it for a fairly large form.
3 Replies
Wayne
Wayne13mo ago
Hi, we don't have a tutorial, but I hope these two links can help. https://www.youtube.com/watch?v=dldjCPa9ZW4 https://stack.convex.dev/typescript-zod-function-validation
PedroTech
YouTube
React Hook Form with ZOD Tutorial - React and Typescript Form Valid...
To try everything Brilliant has to offer—free—for a full 30 days, visit http://brilliant.org/PedroTech/. The first 200 of you will get 20% off Brilliant’s annual premium subscription. In this video we go over react form validation using zod and react hook form. Join our Discord: https://discord.gg/WE92Cqs6Vk 🚀 Learn ReactJS By Building 6 Pro...
Using Zod with TypeScript for Server-side Validation and End-to-End...
Use Zod with TypeScript for argument validation on your server functions allows you to both protect against invalid data, and define TypeScript types ...
BELL
BELLOP13mo ago
Thanks, Ive had a look at these. Probably a stupid question. But i dont see any examples using insert? They all use ctx.db.get, and my old mutations which had ctx.db.insert break as soon as i try change over to using the zQuery helper.
erquhart
erquhart13mo ago
You'll need to make a zMutation helper. zQuery uses customQuery from convex-helpers, you'll make a zMutation with customMutation, which convex-helpers also exports.

Did you find this page helpful?