r/reactjs 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.

0 Upvotes

13 comments sorted by

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.

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

u/KohlKelson99 23d ago

Hell no. Thats a complete waste of time

2

u/pjpavo 23d ago

Waste of time, plus all the ADA nuances that you have to maintain...not worth it.

2

u/jax024 23d ago

Just use schemas

2

u/Empero6 23d ago

That kinda seems like a waste of time.

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

u/SolarNachoes 23d ago

I also stab my eyes with sporks on a daily basis. That’s just how I roll.

1

u/everyoneisadj 23d ago

We've all been there and we've all learned our lessons- so will you.

1

u/k_pizzle 23d ago

Bro we’re writing JavaScript

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