r/reactjs • • Dec 17 '23

Discussion Is react hook form overhyped?

I created a custom form validation hook.Its a simple hook and I felt I didn't needed react hook forms for just simple form validation. For simpe validation writing that much code and loading the whole library felt not right. Maybe I am wrong.

0 Upvotes

45 comments sorted by

View all comments

20

u/nirvashprototype Dec 17 '23

I really like React Hook Form with Zod

18

u/svish Dec 17 '23

I liked it with zod. The moment I ran into field validation depending on other fields, zod started to really suck.

I still use it for parsing and validating API responses, local storage, and config files, but for forms I've moved over to Yup. The types are a bit more iffy, but the .when feature is absolutely essential to stay sane and keep the UX good while user files out a form.

6

u/vermontbikeguy Dec 18 '23

+1 for RHF & yup. I work on a very complex form with a ton of conditional logic, and moving from handling validation inside the register calls to using yup schemas was absolutely essential in allowing us to scale.

TLDR: .when() is 🐐