Skip to content

Instantly share code, notes, and snippets.

@devakone
Last active June 12, 2019 18:38
Show Gist options
  • Save devakone/ae203d3a4b2e9d19e101b765219b11f0 to your computer and use it in GitHub Desktop.
Save devakone/ae203d3a4b2e9d19e101b765219b11f0 to your computer and use it in GitHub Desktop.
How to use the WithTranslateFormErrors HOC
<Formik
render={({ handleSubmit, handleChange, handleBlur, setFieldTouched, values, errors, touched }) => (
<WithTranslateFormErrors errors={errors} touched={touched} setFieldTouched={setFieldTouched}>
<form onSubmit={handleSubmit}>
<input
type="text"
onChange={handleChange}
onBlur={handleBlur}
value={values.name}
name="name"
/>
{errors.name &&
<div>
{errors.name}
</div>}
<button type="submit">Submit</button>
</form>
</WithTranslateFormErrors>
)}
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment