I have tried to write the multiple error line which is using formik
and yup
validation. After use this.createError()
it turns error message as string not array as {errors: '4 errors occurred'}
.
example code that I did:
const messages = [
{ key: "length", message: "should have password at least 8 characters" },
{ key: "notRepeat", message: "should not repeat old password" }
];
this.createError({
path: `${this.path}`,
message: messages,
errors: messages
});
What I need to be is errors that I need it to return as messages([]) Constance then I show a list of error thru UI.
Any comments or suggestions to solve this?
Thank you.