0

I am using eslint react plugin and I got an following warning. React Hook useEffect has a missing dependency: 'setEmail'. Either include it or remove the dependency array.

Here is the code snippet that occurs warrning.

  useEffect(() => {
    const email= localStorage.getItem('email');
    if (email) {
      setEmail(email);
    }
  }, []);
2
  • Is setEmail defined by a useState hook? Commented Jun 7, 2020 at 11:53
  • No. const setEmail = email => setFormState({ ...formState, email });. setFormState is defined by a useState hook. Commented Jun 7, 2020 at 11:56

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.