Real-Time Form Validation in React using React Form Hook Registration Form

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.ย. 2024
  • Registration Form is one of the major part of web development but making it secure is a tough task and making it user-friendly becomes even harder for a developer to go forward.
    In this video we gonna take a look at how to make the registration form secure and even more intuitive for users to understand by displaying an error on the screen when the user submits the form using React Hook Form plugin for React JS.
    Source Code : github.com/rec...
    Checkout full playlist : • React Projects
    Timeline
    Intro (00:00)
    Support us on
    ☕ @Buy me a coffee - www.buymeacoff...
    🎗@Patreon - / recoding_io
    Follow us on
    📝 @Medium - / recoding
    🐦 @Twitter - / recoding_io
    🦄 @Dev.to - dev.to/recoding
    📌 @Pinterest.com - / recoding_io
    🔗 @LinkedIn.com - / recoding-io
    #️⃣ @Hashnode - recoding.hashn...

ความคิดเห็น • 23

  • @AnkitKumar-xq5xe
    @AnkitKumar-xq5xe ปีที่แล้ว +1

    Easy to understand. To the point

  • @letem748
    @letem748 ปีที่แล้ว +1

    i get this error: The tag is unrecognized in this browser.

  • @arunavamukherjee7549
    @arunavamukherjee7549 2 ปีที่แล้ว +1

    Great video. Simple and effective. Thanks

  • @tremolony4924
    @tremolony4924 2 ปีที่แล้ว +1

    Excellent video. Thank you sir

  • @namaltharindu3235
    @namaltharindu3235 2 ปีที่แล้ว +1

    good job.thanks for the help.

  • @Lit_Recap
    @Lit_Recap ปีที่แล้ว

    very simple, thank you

  • @AjayBhargav-tb1ol
    @AjayBhargav-tb1ol ปีที่แล้ว +1

    Great explanation and how do you display the error for select tag ?

    • @Recoding
      @Recoding  ปีที่แล้ว

      Could you please further describer your question as what is select tag?

  • @karimkouki9206
    @karimkouki9206 2 ปีที่แล้ว +1

    thnks ❤

  • @Lit_Recap
    @Lit_Recap ปีที่แล้ว

    how do you display the error for a type of radio buttons if they are not slected

    • @Recoding
      @Recoding  ปีที่แล้ว

      Use this code, The Radio Button will show error when not selected, hope your query might be resolved.
      Occupation
      Job
      Freelancer
      {errors. occupation?.type === "required" && "Occupation is required"}

  • @abdouskittou8561
    @abdouskittou8561 ปีที่แล้ว

    Thank you so much.

    • @Recoding
      @Recoding  ปีที่แล้ว

      You're welcome!

  • @arunavamukherjee7549
    @arunavamukherjee7549 2 ปีที่แล้ว +1

    How how do clear the form input without refreshing the browser?

    • @Recoding
      @Recoding  2 ปีที่แล้ว +3

      Create a new React Hook for all the fields inside the form
      const [values, setValues] = useState({
      name: '',
      email: '',
      phone: '',
      });
      Then inside each input tag add value parameter
      Similarly do for all the input tags
      Then when user click submit button and there is no error inside the form state
      we can set the value of these states to empty string value

    • @arunavamukherjee7549
      @arunavamukherjee7549 2 ปีที่แล้ว

      Awesome thank you

    • @arunavamukherjee7549
      @arunavamukherjee7549 2 ปีที่แล้ว

      Also how do you confirm the password? Thanks

    • @Recoding
      @Recoding  2 ปีที่แล้ว +2

      To do so you need to require more function from React Hook Form
      const { register, errors, handleSubmit, watch } = useForm({});
      Then create a reference of Password
      const password = useRef({});
      password.current = watch("password", "");
      {errors.password && {errors.password.message}}
      Then inside the password confirm input box add a ref function and check that if the password is matching or not
      value === password.current || "The passwords do not match"
      })}
      />
      {errors.password_repeat && {errors.password_repeat.message}}

    • @arunavamukherjee7549
      @arunavamukherjee7549 2 ปีที่แล้ว

      You are awesome. Thanks for the prompt reply.

  • @tonyg_nerd
    @tonyg_nerd ปีที่แล้ว +1

    Please change title to "using React Hook Form"

  • @sathish2654
    @sathish2654 ปีที่แล้ว

    Worst not explaining properly 🤬🤬🤬🤬

    • @Recoding
      @Recoding  ปีที่แล้ว

      Could you please tell us more detail explanation what didn't you understand, we'll let you know the complete concept of this video.