Exercises
The following are some exercises for you to complete:
- Add a feature that clears any validation errors when the user corrects them. Use the
onChange
handler for this rather thanonBlur
, since we want to let the user know as soon as they’ve corrected the error. - Add a feature that disables the submit button once the form has been submitted.
- Write tests for each of the functions within the
formValidation
module. - The
handleSubmit
function is long. Extract adoSave
function that pulls out the main body of theif
statement.