I have the following code:
const {
values,
handleChange,
setFieldValue,
handleSubmit,
isSubmitting,
isValid
} = useFormikContext();
And i have the formik form inside a const comp
const Body = () => {
...
return(
<Formik
....
....>
{props=>{
<Form>
... then some fields here... etc
...
...
</Form>
}}
</Formik>
}
It gives me this error:
TypeError: Cannot destructure property 'values' of 'Object(...)(...)' as it is undefined.
I've also checked this question: Formik 2.0.1 useFormikContext formik values undefined
however it didnt work even writing useFormikContext() inside Body