DEV Community

Discussion on: Simple way to write forms in React with Formik

 
victorocna profile image
Victor Ocnarescu

The drawback to using "basic" form logic instead of a specific package like Formik is it can get complicated along the way. And most of the times it does get more complicated.

Imagine you start a simple login form, everything is great. Basic HTML5 validation works. Then your client comes up and wants to display an error message tied to the username field, only when the form was already submitted and the username does not exist (check the login on Netflix for this exact scenario).

Now here is the part it gets messy. You don't exactly know what to do. Should you implement these yourself? Or maybe a package like Formik? It did not get too complicated, it's still a form with 2 fields: username and password.

Of course, you are right about the HTML5 validation. You can get that for free in every browser and it improves UX. But Formik (or a similar package that improves forms) is the next best thing. Forms get messier and messier as your projects evolve.

Thread Thread
 
hamid2117 profile image
Hamid

Yes you get a point .