I have a condition in email validation.
If the email textbox is empty.. Return true
If the email textbox is not empty, check the text box is that valid email or not
If it was not valid email.. Return false
isEmailValid = () => { const { Email} = this.state; var filter = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/; if(Email=='') { return true; } else{ Alert.alert("Error", I18n.strings("requiredField", { name: I18n.strings("account.emailId") })); return false; } return true; }
What is condition to do in else?