confirm password validation react-hook-form code example
Example: how to validate password and confirm password on react form hook
const validationSchema = yup.object().shape({
newPassword: yup.string()
.required('New Password is required'),
confirmPassword: yup.string()
.required('Confirm Password is required')
.oneOf([yup.ref('password'), null], 'Passwords does not match'),
});