Reactjs debunce

//Wait 500ms before validating data
//This method is used to check if the user stopped typing
//This way the state does not change on every keystroke the user enters!
const [formIsValid, setFormIsValid] = useState(false);

useEffect(() => {
  setTimeout(() => {
    console.log('Checking form validity!');
    setFormIsValid(enteredEmail.includes('@') && enteredPassword.trim().length >6);
  }, 500);
}, [enteredEmail, enteredPassword]);
S3NS4