Apps often require users to enter information into a text field. For example, you might require users to log in with an email address and password combination.
To make apps secure and easy to use, check whether the information the user has provided is valid. If the user has correctly filled out the form, process the information. If the user submits incorrect information, display a friendly error message letting them know what went wrong.
In this example, learn how to add validation to a form that has a single text field using the following steps:
- Create an Input wrapped in FormControl.
- Add validation logic.
- Create a button to validate and submit the form.
Create an Input wrapped in FormControl.
Add validation logic.
Create a button to validate and submit the form.