A notification badge shows the number of unread messages and a button to dismiss them one at a time. Clicking Mark as Read decrements the unread count by one.
The component area is blank on load. No count, no button, no output of any kind.
Look at every line in the component body and consider whether all of them belong there.
Look at every line in the component body and consider whether all of them belong there.
Why this fixes it
`setCount(INBOX_COUNT)` ran in the component body on every render. Each call scheduled a state update, which triggered a new render, which called `setCount` again - a loop with no exit. React detects this and throws "Too many re-renders" before committing anything to the DOM. `useState` already accepts the initial value as its argument, so passing `INBOX_COUNT` directly and removing the standalone `setCount` line sets the starting value once at initialization with no setter involved.