DEV Community

loading...

Discussion on: React Hook Form: the best form library?

Collapse
matfrana profile image
Matteo Frana Author

This library uses the "Render props" pattern which I don't like. I think hooks are a much cleaner pattern.
The documentation of React Hook Form is much better, too. This library leverages Storybook to let you learn by examples, but I prefer a more organized documentation.

Anyway, I never used ant.design, but I'm quite sure you could easily wrap their components using React Hook Form's Controller component

Collapse
eminqasimov profile image
Emin Qasimov

no, it was not easy to me to handle antd ui inputs with react hook form, (it cause so much rerenders) Hook form needs to pass ref of inputs to control them,(i cant pass ref to ant input) but field-form uses new hooks and context, i have not used render props with it, field-form is part of antd design community. yes its doc is not clear, but every case exampls is presented on antd docs. i loved its api.

Thread Thread
bluebill1049 profile image
Bill

Hey Emin,

React Hook Form author here, It's great to hear feedback from the community. I am glad you enjoyed using field-form, and we should all appreciated the hard work that the author have putting in. In case, you may take a look again with RHF, let me know if you have any problems with it, we can work it out. In terms of integrate with external components, we are doing it pretty nicely IMO:

Controller:
react-hook-form.com/api#Controller

Codesandbox: examples with MUI, react-select and etc.
codesandbox.io/s/react-hook-form-c...

Thread Thread
davidshare profile image
David Itam Essien

Can we get examples for ant design, because nothing I have tried works.

Thread Thread
bluebill1049 profile image
Bill

Have a look at this section: react-hook-form.com/api#Controller and this codesandbox which in the doc as well: codesandbox.io/s/react-hook-form-v...

Thread Thread
davidshare profile image
David Itam Essien

I have looked at it over and over again. Even copied the code from the sample into my own form as it is. That does not work. I cannot get values or the errors from the input. By the way, I am using React 17, could that be the issue?

Thread Thread
bluebill1049 profile image
Bill

no, i don't think. send a question at Github discussion and bring a coedesandbox as well.