DEV Community

loading...

Discussion on: Creating Dynamic Forms with React Hooks

Collapse
ferhatavdic profile image
FerhatAvdic

Great post on dynamic forms. Im curious how this would play with formik forms and yup validation.

Collapse
aaronpowell profile image
Aaron Powell Author

To integrate with formik (and just to be transparent, I'm not an expert on formik) I would start with wrapping the <form> element with <Formik> and provide it with the information for current page (the fields and values), but not the whole form.

This way formik doesn't have to concern itself with the fact that it's a multi-step form or that there's conditional logic, you're handling that externally, and formik looks at the current form view.

Collapse
ferhatavdic profile image
FerhatAvdic

Thanks for the input man!

Id really love to create a template for dynamic forms and use it everywhere in the app. The issue is in the layout the UX team provides. It is often times very different on each page so it might be hard to include props for layout as well. Stripping the code from conditional logic and steps might work. I will probably try it out this year.