Problem Statement
How does React use the virtual DOM to render the UI efficiently?
Explanation
React keeps two versions of the Virtual DOM—previous and current. When a change occurs, React compares them (diffing) and updates only the changed parts in the real DOM, making rendering fast and efficient.