React Password and Confirm Password Validation using Yup

In this example i am going to discuss about password and confirm password validation in react native. To validate password and confirm password i am going to use formik and yup. So in this formik yup confirm password validation, you will learn it from step by step.

So if you don't know confirm password formik react native validation then this tutorial is for you. You can show this error message easily if there is wrong password. So let's see the example code of password and confirm password validation in react native using formik and yup.

Example code:

const validationSchema = Yup.object().shape({
    password: Yup.string().min(6).required("Password Required"),
    confirm_password: Yup.string()
      .when("password", {
        is: (val: any) => (val && val.length > 0 ? true : false),
        then: Yup.string().oneOf(
          "Both password need to be the same"
      .required("Confirm Password Required"),


Hope it can help you.


Facebook Github
A web enthusiastic, self-motivated Full-Stack Web Developer from Dhaka, Bangladesh with experience in developing applications using Laravel Vue and React Js Application.