arrow_backBACK TO DRILLS
Black Beltreconciliation-keyslockPREMIUM

React Preserves State When the Same Component Renders at the Same Tree Position

Two sibling branches of a conditional render both return a Counter component at the same JSX position.

REACT_MODULE // 0x42
function App({ isDark }) {
return (
<div>
{isDark ? <Counter theme="dark" /> : <Counter theme="light" />}
</div>
);
}

When isDark toggles and the app re-renders, does Counter's internal state (like a count from useState) reset or persist?

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.