Skip to content

Instantly share code, notes, and snippets.

@tdeekens
Created June 27, 2018 10:15
Show Gist options
  • Save tdeekens/4366d20fdfc49ce924540f472bd25f33 to your computer and use it in GitHub Desktop.
Save tdeekens/4366d20fdfc49ce924540f472bd25f33 to your computer and use it in GitHub Desktop.
const DiscountCodeNameField = props => (
<React.Fragment>
<TextInput
name="name"
value={props.formik.values.name}
hasError={Boolean(
props.formik.touched.name && props.formik.errors.name
)}
onChange={props.formik.handleChange}
onBlur={props.formik.handleBlur}
isDisabled={props.formik.isSubmitting}
/>
<ValidationError.Switch
errors={props.formik.errors.name}
isTouched={props.formik.touched.name}
>
<ValidationError.Match rule="required">
<ErrorMessage>
<FormattedMessage {...messages.required} />
</ErrorMessage>
</ValidationError.Match>
</ValidationError.Switch>
</React.Fragment>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment