DEV Community

Cover image for 🔥 The must-have custom React hook for any web application. 🔥
Better Coding Academy
Better Coding Academy

Posted on

🔥 The must-have custom React hook for any web application. 🔥

About Me: I've been a professional web developer for just over 10 years now. I'm currently the lead web development instructor at Better Coding Academy, and as part of what I do, I post videos on our YouTube channel at

(Subscribe for awesome web development content!)

After building form after form in React, I've come to realise that something was needed to really make labels work well. After many iterations and now rewritten to support React hooks, I've come up with the useGenerateId React hook – and I think it's truly a must-have for any React app.

Here's the 10-minute video justifying its use, writing it up, and explaining how it works:

Here's the code on GitHub, if you would prefer:

Happy coding!

Top comments (3)

cuongtr72831649 profile image

Such a good hook ! Thanks a lot

cristobalgvera profile image
Cristóbal Gajardo Vera

Nice explanation dude, it's an interesting hooks btw, it works pretty well!

bettercodingacademy profile image
Better Coding Academy

Thanks! Glad you enjoyed :)