arrow_backBACK TO DRILLS
Blue BeltstrictmodelockPREMIUM

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?

lock

This Drill is Locked

This is a premium drill. Continue on to the next free drill in the sequence.

CONTINUE DRILLarrow_forward
BugDojo
BlogFAQ

© 2026. Carved in code.