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
Hello, how can we update the website with more information?
I was trying to create a new component and use Formik, I found I had to set the event target value to make it worke.target.value = enteredPhoneNumber.toString() and have to pass the entire event to the onChange(). I spent a good amount of time trying to make the custom component work, no where in the documentation did it mention this directly. The only place I found explicitly telling me this was in the useField() page of the website https://formik.org/docs/api/useField.
I am addressing the fact that the documentation on on the Formik website needs to clarify and explicitly tell clients that the event must be passed to the onChange(e). A nice red Notice would do just find. Just like below. It be best suited for the tutorial, near the custom component section.
NOTE: always pass the event to onChange()/handleChange() in Custom Components. If you need to change the value, because of formatting, set the value of e.target.value = formattedValue.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, how can we update the website with more information?
I was trying to create a new component and use Formik, I found I had to set the event target value to make it work
e.target.value = enteredPhoneNumber.toString()
and have to pass the entire event to theonChange()
. I spent a good amount of time trying to make the custom component work, no where in the documentation did it mention this directly. The only place I found explicitly telling me this was in theuseField()
page of the website https://formik.org/docs/api/useField.I am addressing the fact that the documentation on on the Formik website needs to clarify and explicitly tell clients that the event must be passed to the
onChange(e)
. A nice red Notice would do just find. Just like below. It be best suited for the tutorial, near the custom component section.NOTE: always pass the
event
toonChange()/handleChange()
in Custom Components. If you need to change the value, because of formatting, set the value ofe.target.value = formattedValue
.Beta Was this translation helpful? Give feedback.
All reactions