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

Show parent comments

10

u/bassamanator Dec 17 '23

With formik, I found that there is a re-render every keystroke into a textbox, for example. With react-hook-form, this is magically not the case.

2

u/superluminary Dec 17 '23

That is magical. How are they doing binding without a rerender? Also, how does it deal with custom components if it’s not triggering a render on the parent?

9

u/volivav Dec 17 '23

It's not magical. It's just uncontrolled components, meaning the state doesn't update on every value change.

If you use the useWatch hook to receive updates from one field, that component will rerender.

2

u/TScottFitzgerald Dec 18 '23

Yeah I think it also depends on what type of validation you choose. If it's the default onSubmit it won't rerender but iirc I had some weird UX behaviour there cause the validation obviously only triggers once you click the submit button.