React Training: When do I use functions in a Hooks Dependency Array?
Good analogy made in this article. You must include state in useEffect dependencies array, and some props. Which props? Props that might change, because "props are someone else's state".