Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumReactuseEffect dependency arraysSingle-choice MCQ

How many times does this effect run across the initial mount and a click that increments `count` to 1, given the dependency array?

function Counter() { const [count, setCount] = useState(0); useEffect(() => { console.log('run', count); }, [count]); return <button onClick={() => setCount(c => c + 1)}>{count}</button>; }