React is not a full framework like Angular. It is a UI library: you bring your own router, data layer, and build tooling—or adopt meta-frameworks like Next.js after this track.
Core ideas
- Components — reusable functions (or classes) that return UI descriptions
- Declarative rendering — you return JSX; React reconciles it with the DOM
- One-way data flow — props flow down; events and callbacks flow up
- Hooks — functions like
useStateanduseEffectadd state and lifecycle to function components
Compared to jQuery or vanilla JS
Vanilla code often reads: “find this button, attach listener, find that div, set innerHTML.” React reads: “when count is 3, render this markup.” The state is the source of truth; the UI follows.
Important interview questions and answers
- Q: Is React a framework or a library?
A: A library focused on the view layer. Routing, global state, and data fetching are typically separate choices. - Q: What is the Virtual DOM?
A: An in-memory representation React compares between renders to compute minimal DOM updates—not a second DOM you manipulate directly. - Q: Why is React popular?
A: Component model, large ecosystem, strong hiring demand, React Native for mobile, and mature patterns for complex UIs.
Self-check
- Name two things React gives you that raw
document.querySelectordoes not. - What does “one-way data flow” mean in one sentence?