Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardReactreconciliation diffingSingle-choice MCQ

Two sibling elements render the same component type at the same position across renders, but you change `key` from "a" to "b". The element type and props are otherwise identical. Why does React still unmount the old fiber and mount a fresh one, including resetting all internal hook state?

return showFirst ? <Editor key="a" doc={doc} /> : <Editor key="b" doc={doc} />;