zaguiini / formik-wizard

A multi-step form component powered by formik and react-albus
MIT License
86 stars 26 forks source link

Give state from MultiForm to FormWrapper #25

Closed brechtarnou closed 4 years ago

brechtarnou commented 4 years ago

Hi,

Is it possible to give state from my MultiForm to Formwrapper?

`function MultiForm(props) { console.log(props) const handleSubmit = React.useCallback(values => { console.log("full values:", values)

return {
  message: "Thanks for submitting!",
}

}, [])

return (

) }

export default MultiForm`

As you can see this is the MultiForm component, and I want to pass some state to my FormWrapper to render the correct button.

`function FormWrapper({ children, isLastStep, status, goToPreviousStep, canGoBack, actionLabel, type, }) { console.log(type) return (

{status ? (
{status.message}
) : ( <> {children}
{type === "betalen" ? ( {actionLabel || (isLastStep ? "Betaal nu" : "Volgende")} ) : ( {actionLabel || (isLastStep ? "Verzend PDF" : "Volgende")} )}
)}

) } ` But the type prop I want to pass through is undefined in my FormWrapper.

Thanks in advance.

zaguiini commented 4 years ago

For those type of questions, StackOverflow is better suited. Please create a topic there describing your problem. Thanks!