What is React and why use it over plain JavaScript?
Quick answer
React is a declarative, component-based UI library. You describe UI for a given state and React efficiently updates the DOM to match.
In detail
React lets you build UIs from reusable components and write them declaratively: you describe what the UI should look like for the current state, and React figures out the minimal DOM updates via its virtual DOM. Compared to manual DOM work, this removes a whole class of bugs around keeping the UI in sync with data, and the component model makes large apps maintainable. It is a library (not a full framework) focused on the view layer.
// Declarative: describe the UI for this state
function Greeting({ name }) {
return <h1>Hello, {name}</h1>;
}
// vs imperative DOM: createElement, textContent, appendChild...💡Say this
React's core idea is UI = f(state). You manage state; React manages the DOM.
Why interviewers ask this: The opener that checks you understand React's purpose, not just its syntax.
Common follow-up questions
- →Is React a library or a framework?
- →What problem does the virtual DOM solve?
This is 1 of 118+ questions in the React Interview Kit
Get every question with detailed answers, follow-ups and real code — plus coding challenges and a last-minute revision sheet. One-time payment, instant access.
⚡ Get the React Interview Kit → ₹399