Open fnpen opened 5 years ago
I found an example. I need to throw exception:throw errors;
<Formik
initialValues={{ name: '' }}
validate={async () => {
const errors = {
name: 'Not valid'
};
throw errors; // OK
}}
onSubmit={() => {}}
>
This seems to be working now. I just tried to reproduce the error in codesandbox:
Errors correctly appear in props.
Is there an issue reported about this?
For future travellers: Formik pre-2.0 used throw errors
, v2.0+ uses return errors
.
Source: https://github.com/jaredpalmer/formik/releases/tag/v2.0.1-rc.5
This issue can probably be closed.
🐛 Bug report
<Formik validate={async() => {}} /> is not working. I'm using it for server validation.
Current Behavior
"errors": {}
Expected behavior
Reproducible example
https://codesandbox.io/s/1oo6z653v7
Suggested solution(s)