Type error when using react-hook-form submit handler
So I'm using react-hook-form with a fresh T3 app, but I'm getting the following error.
Has anyone else encountered this?
9 Replies
that's expected, eslint is just being strict on you
this happens due to a eslint rule, one way i found to bypass it is by creating an anonymous arrow function and marking the function call as void
something like this
() => void handleSubmit()
lol thanks you two!
Works even without the
void
btw. @shiroyasha_ah i see, pretty cool
Actually, this breaks my Form
oh it would aye, you'd need to do
onSubmit={e => handleSubmit(onSubmit)(e)}
but that may bring back the original error
honestly i'd just turn off the eslint rule
or make a custom form component that allows for the correct typesUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
Thanks for the suggestions! Man, in theory I like this rule but I think I'll just turn it off
@jonasmerlin
this is so crazy I had litterally the exact same problem, came to the exact same solution (only to find it broke my form) and then found this trying to fix it
I also decided to just ignore the rule. Frustrating that making it a IIFE breaks the form, might open a issue on the repo about it.