And we will see what it takes to implement it in our “Add user form” example.
Each helper accepts an arbitrary number of attribute names, so with a single line of code you can add the same kind of validation to several attributes. Let's take a look at each one of the available helpers.
To do that, we need to tell it about an error somehow.
And we wouldn’t like to pass a lot of additional props, because it will eliminate all the benefits.
One thing is that field is required, and completely different one is that it has to be valid.
So, that’s how we’re doing simple form validation:we can do a lot of interesting things with just a raw React state. Meanwhile, if you like what you see, you can start playing with links.