Next.js Discord

Discord Forum

Custom input with react-hook-form not retrieving any values

Unanswered
Northeast Congo Lion posted this in #help-forum
Open in Discord
Northeast Congo LionOP
https://stackblitz.com/edit/stackblitz-starters-xwtaxu?file=app%2Fpage.tsx I've integrated react-hook-form in my form, that is using a custom Textfield component. I've followed the react-hook-form guide, but when I click submit the values are not updated. They are blank. Can it be something related to nextjs that I'm forgetting ?

3 Replies

Northeast Congo LionOP
can anyone help me ?
1. You need to pass default values to useForm, such as an empty string
2. It is better to use register(label) directly instead of passing the function through props
3. Remove onBlur prop from input, it overrode the one returned from register function