4.2 React controlled forms and validation

2h Controlled forms are really just controlled components that return form elements, but anyways… This didn’t seem to be that hard. There did seem to be a lot of moving pieces to the full form validation example, but I’ll get it down in another example or two.

Validation was similarly straightforward. It was just a method that was called in the onChange event and it would either setState to be an error object or not. Later on it was used to prevent submission of the form as well, because the validator would return false or true at the end of it’s logic.

Today is day 274 of studying and 275 since I started. I don’t really care that I lost my streak. I still have the knowledge, and it was nice of the streak to help motivate me. I had bigger motivators telling me not to study yesterday, and I made the right choice.

Tell me what you think.

This site uses Akismet to reduce spam. Learn how your comment data is processed.