❓ Question
Currently the innerRef has signature of (instance: any) => void
which does not fit any type I can remind of, like FormikProps
or FormikHelpers
Before that when I was using the 1.5 version where I could call methods like setFieldTouched
on the ref therefore an inner Ref should be of type FormikHelper
or at least inherit it. The (instance: any) => void
looks broken
Since TypeScript is not really helpful i used
as
casting.<Formik innerRef={instance=>{formikRef=instance}}
{…otherProps}/>`This however makes a non-constant
formikRef
variablelet formikRef = useRef(null) as any;
I do not think this is correct way with 2.x