Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6212

Formik form with two types for FormikProps

$
0
0

Is it possible to have Formik form with two values for FormikProps?

I have a form wrapper which can display different forms. FormWrapper:

type FormData = SignUpData | SignInData;interface FormWrapperProps extends FormikProps<FormData>{   ...}

It will display one form which will be either of SignInData type or SignUpData type. But when I try to pass specific formik prop like this in SignUpScreen:

<FormWrapper  {...formikProps}/>

It will show this error:

Type FormikData is not assignable to type SignUpData. Type SignInData is missing the following properties from type SignUpData: name


Viewing all articles
Browse latest Browse all 6212

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>