score:4

Accepted answer
A // First render
B // Mount

A // State change from 0 -> 42, triggers render
B // useEffect dep array change, triggers callback

A // **Our issue**, React needs another render

score:0

const handleButtonClick = () => {
  setCount(1); //this line has been added extra
  setTimeout(() => {
    setCount(0);
  }, 500);
};

Related Query

More Query from same tag