Need help with react forms

Should I use react-hook-form or write my own code for iniput and validation? What do you suggest? What is the preferred industry practice?

Thank you!

There’s already enough validation libraries out there, there’s no need to write any more.
react-hook-form is quite nice, validation is only a fraction of what it does. I wish I had something as nice in my Vue projects (I don’t much care for vuelidate).

That said, reinventing wheels is a good learning process. Just don’t drive a thousand miles on them :slight_smile:

If you’re trying to build a web page, don’t bother writing your own forms, stand on the shoulders of giants. You will never write anything as good or well tested as what they do.

If you want some experience and are curious, write your own forms.

React hook-forms uses Yup for it’s validation… this is a separate library that can be used for form validation in Vue as well,

1 Like

I have used React Hook form in a project… it makes things a lot easier to set up, everything is there out of the box.

That said… if you are working on a project to learn React. I recommend spending some time learning how forms work in React. Create your own form, learn how to add form data to state/post to DB in React etc. Developing a good understanding of the basics of React will only help you going forward! :nerd_face: I think it is valuable to learn controlled and uncontrolled forms in React.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.