Description

A profile panel reads from a selected user object and displays a personalised greeting. Clicking a different user button should update the greeting immediately.

Anomaly

Click any user button - the greeting never changes from the first user's name. The button label updates correctly but the panel stays stale.

Constraint
Do not move the greeting logic outside the effect
Do not replace greeting state with inline derivation
Hint
Consult the SenseiOnly for those truly stuck · Flip to reveal

The effect runs once and captures something - what did it capture and when?

Loading editor…
Correct Solution
Loading...

Why this fixes it

The effect closed over `user` at mount with an empty dependency array, permanently capturing the first user object. Every subsequent user selection updated state but the effect never re-ran, so the greeting stayed frozen on Alice. Adding `user` to the dependency array tells React to re-run the effect whenever `user` changes - each button click updates `user`, the effect fires again, and the greeting reflects the currently selected user.

Expected OutputGoal State
Your OutputLive