Yup schema validation password and confirmPassword doesn't work
Try this out:
import * as Yup from 'yup';
validationSchema: Yup.object({
password: Yup.string().required('Password is required'),
passwordConfirmation: Yup.string()
.oneOf([Yup.ref('password'), null], 'Passwords must match')
});
Based on @anoNewb answer and the request made by @Renan,
Yup.object({
password: Yup.string().required('Password is required'),
passwordConfirmation: Yup.string()
.test('passwords-match', 'Passwords must match', function(value){
return this.parent.password === value
})
})