Skip to content

Instantly share code, notes, and snippets.

@merictaze
Last active September 8, 2019 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merictaze/94282b147a4b1a2e36d566aee54dbb46 to your computer and use it in GitHub Desktop.
Save merictaze/94282b147a4b1a2e36d566aee54dbb46 to your computer and use it in GitHub Desktop.
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