arrow_backBACK TO DRILLS
Black Beltreconciliation-keysPREMIUM
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?