The problem

Validating forms shouldn’t be so rough. It’s something almost every website should be doing. Sure, you have those nice HTML5 input types now, and a required flag, but that doesn’t get you far when you have design and business requirements to deal with.

As with most hard problems, there has been a lot of attempts by the community to solve this. Most notably is the redux-form project, which places all of your form state in a Redux reducer, and passes you all the form values on submit. It works well for its intended purpose — but it still leaves you implementing the actual validation.

There are tons of great validation libraries out there too. My favorite for a long time was validation. You pass some input, and you get a boolean back indicating whether or not the value is valid according to the given validator.

The problem with this approach is that you’re still left implementing a lot of logic! You have to create some kind of way to show error messages, support live validation, multiple validation rules per field and compound validation that depends on other fields.

Relax buddy, I got you.