Description

A component fetches a count from a slow API and displays it. The page freezes because the effect runs in an infinite loop.

Anomaly

The component never settles — it keeps re-fetching endlessly, the count flickers or the browser tab becomes unresponsive.

Constraint
The fetch must stay inside the useEffect
Fix only the dependency array
Do not add a loading guard or extra state
Hint
Consult the SenseiOnly for those truly stuck · Flip to reveal

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.

Loading editor…
Correct Solution
Loading...
Expected OutputGoal State
Your OutputLive