JoaoCnh / react-loki

A React Wizard...... pun intented
MIT License
8 stars 9 forks source link

How to pass props to Step components ? #3

Open l-imbert opened 4 years ago

l-imbert commented 4 years ago

Hey,

Just a quick question on how to implement react-loki with Formik. How do you go about passing fomik props to steps components ?

` const customSteps = [ { label: 'Step1', number: '1', description: 'General informations', component: , }, { label: 'Step2', number: '2', description: 'Cicero text generator', component: , }, { label: 'Step3', number: '3', description: 'Wonderful transition effects', component: , } ];

And then in the child Step1 component : const { handleChange, handleBlur, values, errors} = props

`

But values. name is undefined ! How to get Formik values passed down through react Loki ?

Thanks in advance for your help !!!!!!

adityasanil commented 3 years ago

Hi @l-imbert you can try converting the const customSteps variable to a func Ex: const customSteps = (yourProp) => { return [ { component: <YourComponent yourProp={yourProp} /> } ] }

Loki component <Loki steps={customSteps(youtProp)}

This worked for me!