React |React Forms | Question 8

Last Updated :
Discuss
Comments

Is this the correct way to validate an email field in React?

JavaScript
const validateEmail = (email) => /\S+@\S+\.\S+/.test(email);

Yes, it's a correct validation function

No, the regular expression is incorrect

No, the function should return an error

No, it should use isValidEmail()

Share your thoughts in the comments