Skip to content

Instantly share code, notes, and snippets.

@merictaze
Last active September 8, 2019 03:06
Embed
What would you like to do?
import {connect} from 'formik';
const FormItem = connect(props => {
const { label, ...inputProps } = props;
const { errors, touched } = props.formik;
return (
<div>
{label && <label>{label}</label>}
<FormInput {...inputProps} />
{errors[inputProps.name] && touched[inputProps.name] && <p>{errors[inputProps.name]}</p>}
</div>
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment