DEV Community

Matt Upham
Matt Upham

Posted on

How to use Custom React Hooks! (React Form Validation made easy, example)

Forms are notoriously tedious to create, manage, and validate.

With old school React, you'd have to create classes, and it was challenging to re-use stateful logic.

Thankfully, with custom React hooks, you can reuse all your logic and reduce the amount of lines of code by ~50%!

Here's a straightforward example of how to do form validation with custom hooks!

Please consider subscribing by clicking here if you found this information useful!
YouTube - Matt Upham

React Hooks Tutorial (Custom Hooks) | Form Validation made easy

React Hooks are a much more concise way of handling stateful logic, and once you'll learn them, you'll be hooked 😜

If you found this video useful, please consider subscribing to my YouTube Channel! I talk about software & tech, life in Silicon Valley, and self-improvement!

Subscribe Here
YouTube - Matt Upham

Thanks for reading!

Top comments (3)

Collapse
 
yogiwisesa profile image
Yogi Wisesa

Now I'm hooked with react hooks :D

Collapse
 
mattupham profile image
Matt Upham

Haha, they're great!

Collapse
 
scriptkavi profile image
ScriptKavi

Why create one when you can get all awesome hooks in a single library?

Try scriptkavi/hooks. Copy paste style and easy to integrate with its own CLI