Skip to content

Instantly share code, notes, and snippets.

@varun93
Created May 25, 2018 07:05
Show Gist options
  • Save varun93/eaf2ab7e0e17862838e4ad1105f8cd8c to your computer and use it in GitHub Desktop.
Save varun93/eaf2ab7e0e17862838e4ad1105f8cd8c to your computer and use it in GitHub Desktop.
const genericFormHoc = ({handleFieldChange,form}) => {
const {fields} = form || {};
const {submit} = form
return (
<div>
{
Object.keys(fields).map((fieldKey) => {
const {field} = fields[fieldKey];
return <Field fieldKey={fieldKey} field={field} handleFieldChange={handleFieldChange} />
})
}
<Button {...submit} />
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment