The example for check valid email format in React

With this example, you can check user input their email is valid or invalid:


Copy this function into your Javascript file:

function isEmailCheck(email) {
  const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
  return email ? re.test(String(email).toLowerCase()) : false;
}


Usage in your component:

 


© 2019 4codev

Created with love by Sil.