In two fields with validation, one of them, needs to be requested if the other has not filled in and vice versa Doing it that way
email: yup.string().email().when('phone', {
is: (phone) => !phone || phone.length === 0,
then: yup.string().email().required(),
otherwise: yup.string()
}),
phone: yup.string().when('email', {
is: (email) => !email || email.length === 0,
then: yup.string().required(),
otherwise: yup.string()
})
});
In my way I have the following error: "Error: Cyclic dependency, node was: value"