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
1
u/sauland Dec 18 '23
In a real world app the resolver setup logic would be abstracted away into a custom
useFormhook, so you wouldn't have to write the full thing every time.Yes, you can't define the conditional validations directly in the schema, but that shouldn't really be a problem since form schemas are tightly coupled to the form component anyways, so usually you would rather want to reuse the component itself than just the schema.
A real life implementation would look something like this, which IMO is pretty straightforward and doesn't require the installation of 2 separate validation libraries: