What will happen when the handleSubmit function is called in the following code?
const [email, setEmail] = useState("");
const [error, setError] = useState("");
const handleSubmit = () => {
if (!validateEmail(email)) {
setError("Invalid email");
}
};
An error message "Invalid email" will be displayed when the email is invalid.
The email will be automatically corrected to a valid format.
The error state will be cleared on each submit.
The validateEmail function will be called without any effect.
This question is part of this quiz :
React Forms