You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then when I want to call field.onChange(), I have to do it like this:
field.onChange(name)(value)
While this doesn't work:
field.onChange(value)
As you can see I have to specify the name once again when calling the onChange(). This seems redundant since
a ) The useField hook is already provided the name
b ) The hook only exposes you to a single field
Expected behavior
I'd expect to be able to call field.onChange without needing to provide the name of the field again.
Suggested solution(s)
Store the field name in the useField hook (I'm guessing that this is already there), then infer the field name in the onChange function (and any other functions that require you to pass a name).
Software
Version(s)
Formik
2.4.3
React
18.2.0
TypeScript
5.1.3
Browser
Chrome
npm/Yarn
Yarn
Operating System
Windows
The text was updated successfully, but these errors were encountered:
Bug report
Current Behavior
When using the
useField()
hook, like so:Then when I want to call
field.onChange()
, I have to do it like this:While this doesn't work:
As you can see I have to specify the name once again when calling the
onChange()
. This seems redundant sincea ) The
useField
hook is already provided the nameb ) The hook only exposes you to a single field
Expected behavior
I'd expect to be able to call
field.onChange
without needing to provide the name of the field again.Suggested solution(s)
Store the field name in the
useField
hook (I'm guessing that this is already there), then infer the field name in theonChange
function (and any other functions that require you to pass a name).The text was updated successfully, but these errors were encountered: