Skip to content Skip to sidebar Skip to footer

How To Pass A Child Component's Validated Data (as A Formik Form) To Its Parent Component And Handle Form Submission In Parent

Is there a way to pass formik form values from a child component to a parent component and handle form submission in parent component only. I have a use case where I'm building a f

Solution 1:

by using props you can achieve this.

Screen 1:

render(
 <View><Screen2onValueChange={() => {
              this.setState({formProps: formProps});
            }}
          />
          <FormButtonformProps={this.state.formProps}
            // @ts-ignoreonPress={formProps.handleSubmit}
            // tslint:disable-next-line:no-duplicate-stringtitle={'checkout'}
          /></View>
)

Screen 2:

if (onValueChange) {
     onValueChange(formProps);
 }

Post a Comment for "How To Pass A Child Component's Validated Data (as A Formik Form) To Its Parent Component And Handle Form Submission In Parent"