Frontend & browser·Rendering and the browser pipeline
the component's state survived the re-render because the framework decided it was the same element as before.
Reconciliation
Also calleddiffing, the diff
The algorithm that matches the new tree against the previous one to decide what to update, what to leave alone, and what to unmount. Its identity rules are what determine whether a component keeps its state or is thrown away and rebuilt, which is why moving a component to a different position in the tree can silently reset it. Understanding those rules is the difference between debugging a state bug and blaming the framework for one.