@mukwende2000
Posted
I get it you don't want to do anything when the form is submitted with an empty email, but i think showing a notification is even much better for user experience, if you really just want to do nothing, you can do it all in the handleSubmit function, you don't need the errorCheck function
function handleSubmit() {
let regex = /^([a-z0-9_\-.]+)@([a-z0-9_\-.]+)\.([a-z]{2,5})$/i
if(!email) return
if(regex.test(email)) {
//your success logic here
} else {
//your error logic here
}
}
Again like i said, showing a notification is much better in my opinion, atleast someone will know why they are not proceeding to the next step.
Marked as helpful
@Imhandegbelo
Posted
@mukwende2000 Thank you for your feedback man. I really appreciate. Unto the next challenge 😃