Q1.What is the Virtual DOM?
The Virtual DOM is a lightweight copy of the actual DOM. React uses it to optimize updates by comparing the new VDOM with the old one (diffing) and only updating changed parts.
Get the Preplance app for a seamless learning experience. Practice offline, get daily streaks, and stay ahead with real-time interview updates.
Get it on
Google Play
4.9/5 Rating on Store
Essential React.js questions covering Hooks, Virtual DOM, Lifecycle methods, and more.
The Virtual DOM is a lightweight copy of the actual DOM. React uses it to optimize updates by comparing the new VDOM with the old one (diffing) and only updating changed parts.
Hooks are functions that let you use state and other React features in functional components without writing a class.
useEffect is a hook that lets you perform side effects in function components, such as data fetching, subscriptions, or manually changing the DOM.