The Virtual DOM is an in-memory representation of the real DOM. React updates the Virtual DOM first, calculates the minimal changes needed, and then updates the real DOM. It's like drafting a document before printing—fewer costly re-renders, better performance.
Interview Flashcards & Mock Mode
Practice with 3D flip cards, voice reader, and timed interview simulations.
CodeShot.in — Daily Challenges
60-second in-browser coding micro-challenges to sharpen syntax and problem-solving speed.
What is the Virtual DOM in React and why does it exist?
What is reconciliation in React?
Reconciliation is the process React uses to compare the previous and new Virtual DOM trees (diffing) to figure out the minimum set of DOM changes required. It makes updates fast and efficient.
What are React Hooks and why were they introduced?
Hooks let functional components use state and lifecycle features that were previously only available in class components. They were introduced to simplify component logic and make code reusable. useState, useEffect, and useContext are the most common ones.
What is the useEffect hook used for?
useEffect handles side effects in functional components—like fetching data, subscribing to events, or updating the DOM. It replaces lifecycle methods like componentDidMount and componentDidUpdate from class components.
What are the rules of hooks in React?
Hooks must only be called at the top level of a function—not inside loops, conditions, or nested functions. They must only be called from React functional components or custom hooks, not regular JavaScript functions.