r/reactjs • u/Last_Distribution_84 • 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
3
u/svish Dec 17 '23
Actually, for forms
superRefineit really terrible.First of all, you get your validation very awkwardly cut in half, or worse. If B depends on A, you can only validate B partially, for example having to keep it optional even if its required when A is true. Even worse when there's a series of dependencies.
Second, and worst of all, zod doesn't even touch the refinements until the whole "base object" is valid. This is fine in most cases, but for forms this means the user doesn't get certain error messages until they've gone through the whole form. Get to the end, and suddenly a whole new "layer" of errors pop up.
For forms, Zod is just awful in every way that matters the most.