When a component’s state changes, it will re-render itself. Usually, it happens either in a callback or in useEffect hook. State changes are the “root” source of all re-renders.

Click on the button and look at console.log

Rerender 0
Link to Code