A counter displays a number and a button increments it. The counter never changes when clicked.
Clicking the button does nothing — the number stays at 0 no matter how many times you click.
Check what value you're actually passing to setCount
Check what value you're actually passing to setCount
Why this fixes it
setCount(count) passed the current value of count straight back into state - because React uses Object.is equality, it compared the new value against the old one, saw they were identical, and bailed out of the re-render entirely. Changing the argument to count + 1 produces a value that is always different from the current state. React detects the new value, schedules a re-render, and the updated count appears on screen.