Description

A feedback form lets users enter a rating and submit it by clicking a button.

Anomaly

The submission fires immediately when the page loads. Clicking the button after that does nothing.

Constraint
Do not add any new hooks
Hint
Consult the SenseiOnly for those truly stuck · Flip to reveal

Look at how the handler is attached to the button - is it being called or passed?

Loading editor…
Correct Solution
Loading...

Why this fixes it

`onClick={handleSubmit()}` called `handleSubmit` immediately during render, setting `submitted` to `true` before any click happened - so the thank you message appeared on load and the button never rendered again. Removing the parentheses to `onClick={handleSubmit}` passes the function reference itself so React calls it only when the button is actually clicked.

Expected OutputGoal State
Your OutputLive