2. When will the validation functions be called in the react js code example
Example: 2. When will the validation functions be called in the react js
onClick={(event) => {
event.preventDefault();
if(
validateName(name, setNameIsInvalid, setNameValidationMsg) &&
validatePhone(phone, setPhoneIsInvalid, setPhoneValidationMsg) &&
validateEmail(email, setEmailIsInvalid, setEmailValidationMsg)
) {
props.addContact(name, email, phone);
}
}}