React Quiz Practice
Active Recall Drill Session
← Exit SessionQuestion 1 of 1
mediumReact
How many times does "rendered" log when the button is clicked 3 times?
code
const Child = React.memo(function Child({ label }) {
console.log('rendered');
return <span>{label}</span>;
});
function Parent() {
const [count, setCount] = useState(0);
return (
<>
<button onClick={() => setCount(c => c + 1)}>{count}</button>
<Child label="static" />
</>
);
}