Whenever the server returns validation errors and we would set them with setFieldError
they would be lost if any field would get a change or blur event. But we want to keep these kind of errors until the specific field changes. Additional we want to handle generic server errors (which are not specific to a field, but the whole form).
With these hooks field specific server side errors should be added like this:
const { setStatus } = useFormikContext();
const errors = {};
// adjust serverErrors to your own responses
// in this case they look like this: Array<{ name: string, error: string }>