arrow_backBACK TO DRILLS
Blue BeltstrictmodePREMIUM
console.log Fires Twice in Development Due to StrictMode
A developer wraps their app in <React.StrictMode> during local development.
REACT_MODULE // 0x42
function Counter() {
console.log('Counter rendering');
const [count, setCount] = useState(0);
return <button onClick={() => setCount(c => c + 1)}>{count}</button>;
}Why does "Counter rendering" print twice in the console for every render, including the first mount, while the browser only ever shows one button?