Can a missing dependency in a useEffect cause this error?

Question

Grade: Education Subject: Support
Can a missing dependency in a useEffect cause this error?
Asked by:
57 Viewed 57 Answers

Answer (57)

Best Answer
(252)
Yes, absolutely. If a variable used within a useEffect hook is not included in its dependency array, React will assume the effect should run on every render. This can quickly lead to an excessive number of hook calls and trigger the 'more hooks' error.