Frontend & browser·State, data and re-rendering
you left a value out of the array to stop the loop and the effect started using an old copy of it.
Dependency array
Also calleddeps array, dependency list
The list telling the framework which values an effect or memo depends on, compared by reference between renders. Omitting a dependency to suppress a re-run produces a stale closure; including an object or function recreated each render produces an infinite loop. Both symptoms come from the same cause, which is why the lint rule is worth obeying and the fix is usually to stabilise the value rather than to hide it.