Replies: 1 comment
-
For those inputs that doesn't sit at the root, you can use: https://react-hook-form.com/advanced-usage#ConnectForm |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I hate doing forms in React. It's just too much work. So when I saw this library and extensive and nice documentation I was inspired. Until now I was using either formik or redux-forms. So after extensive testing I think I will give this library a chance. Especially since unlike formik it handles dynamic fields better.
I saw example of registering fields using createElement to inject props. And I was thinking... it's not very practical. Usually we don't build forms like that:
We build them like this:
So when you present this example:
https://codesandbox.io/s/react-hook-form-smart-form-component-eqb3n?file=/src/index.js
It will stop working the moment you put input into div for styling or some other weird reasons.
So I'm thinking... how about something like that?
https://codesandbox.io/s/react-hook-form-smart-form-component-ke3vb?file=/src/index.js
At least you don't have to worry about component structure inside form. This could be extended to add error messages and other stuff if required.
Beta Was this translation helpful? Give feedback.
All reactions