airair
All questions

How many renders: child of a stateful parent

NewQuizReacteasy~2 minre-render, props, render count
function Child({ label }: { label: string }) {
  console.log("child render");
  return <span>{label}</span>;
}

function Parent() {
  const [count, setCount] = useState(0);
  return (
    <>
      <button onClick={() => setCount(count + 1)}>+1</button>
      <Child label="static" />
    </>
  );
}

After mounting and clicking +1 twice, how many times has "child render" been logged?

Choose one answer