Is it possible to use Formik for react components that don't rely on html <input /> field?
My component is a custom selector that relies only on <div> and <span> elements.
Right now Formik event handler assumes the presence of event.name, which is fine for input components, but for div elements I can't set name on them because it's not valid.
Formik is really great for us, but this is quite a blocker right now.
How should we handle this?
Thanks
So far I have managed to work around it, but it's really hackish.
Here's my solution:
(e) => {
e.target.name = "nameOfThePropIWantFormikToUpdate"
e.target.value = "valueOfThatProp"
this.props.handleChange(e)
}
Use setFieldValue, it鈥檚 built just for this
Thank you so much.
Formik is great
Most helpful comment
Use setFieldValue, it鈥檚 built just for this