A component fetches a count from a slow API and displays it. The page freezes because the effect runs in an infinite loop.
The component never settles — it keeps re-fetching endlessly, the count flickers or the browser tab becomes unresponsive.
An effect that sets state will cause a re-render. If that state value is in the dependency array, the effect fires again after every render.
An effect that sets state will cause a re-render. If that state value is in the dependency array, the effect fires again after every render.