Description

A counter displays its value and a doubled version of it. Clicking Increment should update both numbers together. The doubled value never changes after the page loads.

Anomaly

Click Increment — Count goes up correctly but Doubled stays at 0 forever. The derived value is frozen at the initial value no matter how many times you click.

Constraint
Remove the useEffect and the doubled state variable entirely
Compute the doubled value as a plain variable derived from count in the render body
Hint
Consult the SenseiOnly for those truly stuck · Flip to reveal

The effect that computes the doubled value only runs once on mount because count is missing from the dependency array. The better fix is to not store derived values in state at all — compute them inline during render.

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