State Preservation
⭐ Interview Importance: MEDIUM
⏱️ Revision Time: 2 min
State Preservation
Documentation for State Preservation coming soon.
Interview Questions
Q: How does React know to preserve state between renders for a specific component?
A: State is not tied to the component function itself; it is tied to the component’s position in the UI tree. As long as the component type (e.g., <Counter />) remains exactly the same at the exact same position in the tree across renders, React preserves its state. If the component type changes or is removed, React destroys the state.