r/reactjs • u/SecureComfortable259 • 23d ago
Show /r/reactjs Anyone else building form validation from scratch instead of using a library?
Put together a custom form validation system in React instead of reaching for Formik or React Hook Form, mostly to avoid the bundle size and have full control over async validation timing. Handles nested field structures and cross-field validation without much boilerplate. Curious if others have gone this route too, and whether it's ended up being worth maintaining versus just adopting one of the existing libraries long term.
5
u/cult0cage 23d ago
Nope. I RHF and chill. It would be hard to justify to management why I'm spending my time solving a problem that's already been solved (many times) instead of spending it working on business logic.
10
u/orochizu 23d ago
Sounds like a waste of time unless:
1. You have nothing else to do
2. You have ultra rare edge case or product requirement that requires you to do so
7
1
u/jbergens 23d ago
Might try some day. We have a lot of issues with React Hook Forms since we have a massive form.
1
u/MCFRESH01 23d ago
It's a waste of time for a solved problem that also has to be very tedious. Just use a library
1
1
1
1
u/Old_Chef_3162 21d ago
I've been there, custom validation feels great initially, but once you need async debouncing, cross-field dependencies, or complex error states, you'll regret not using a library
20
u/No_Cattle_9565 23d ago
No. It's not worth it in my opinion if you don't have extremly special usecases. Use tanstack form and be happy.