A feedback form lets users enter a rating and submit it by clicking a button.
The submission fires immediately when the page loads. Clicking the button after that does nothing.
Look at how the handler is attached to the button - is it being called or passed?
Look at how the handler is attached to the button - is it being called or passed?
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.