Description

A component toggles between showing a secret message and a button to reveal it on each click.

Anomaly

The button says "Show Secret" and clicking it does nothing. The secret message never appears.

Constraint
Fix only the toggle logic
Do not restructure the JSX
Hint
Consult the SenseiOnly for those truly stuck · Flip to reveal

What is the onClick handler actually setting `visible` to?

Loading editor…
Correct Solution
Loading...

Why this fixes it

The click handler called `setVisible(false)` unconditionally, meaning every click set `visible` to `false` regardless of its current value. Replacing that with `setVisible((v) => !v)` passes a functional updater that receives the current state value and inverts it, flipping correctly between `true` and `false` on each click.

Expected OutputGoal State
Your OutputLive