React Fundamentals
The warm-up questions. They sound easy, but a weak answer here sets the tone for the whole interview. Aim to sound precise, not textbook.
What is React?
React is a JavaScript library for building user interfaces out of reusable components, created by Meta.
The four ideas that actually define it:
| Idea | What it means |
|---|---|
| Component-based | The UI is split into small independent pieces you compose together, like Lego. |
| Declarative | You describe what the screen should look like for a given state. React works out how to update the DOM. |
| Virtual DOM | React keeps a copy of the UI in memory, compares it after a change, and touches only the parts of the real DOM that differ. |
| One-way data flow | Data flows down from parent to child. That makes bugs easy to trace. |
Declarative vs imperative — the difference in code
// Imperative (plain JS): you give step-by-step instructions
const btn = document.getElementById("btn");
btn.addEventListener("click", () => {
document.getElementById("label").innerText = "Clicked!"; // you touch the DOM yourself
});
// Declarative (React): you describe the result
{clicked ? "Clicked!" : "Not clicked"} // React updates the DOM for you
React is a JavaScript library from Meta for building user interfaces. You build the UI
from small reusable components and describe what each should look like for a given state;
React then uses a Virtual DOM to work out the minimum real DOM updates needed. Data flows
one way, from parent to child, which makes the app predictable. It handles the view layer
only — routing, state management and HTTP come from separate libraries.
Is React a framework or a library?
A library. React only handles the UI — everything else is your choice.
React deliberately leaves out most of what an application needs:
| Need | React gives you | You add |
|---|---|---|
| UI components | ✅ Yes | — |
| Routing | ❌ No | React Router |
| Global state | Context only | Redux Toolkit, Zustand |
| HTTP calls | ❌ No | fetch, Axios |
| Forms | ❌ No | React Hook Form |
| Build tooling | ❌ No | Vite |
People sometimes call React a framework because of the ecosystem around it, and Next.js genuinely is a framework built on React. But React itself is a library. Saying that distinction out loud shows you understand it rather than reciting it.
React is a library — it only covers the view layer. Routing, state management, HTTP and
forms all come from separate packages that you choose. That's the trade-off: more
flexibility, but the architecture decisions are yours. Next.js, which is built on React,
is the framework version of it.
What is the difference between a library and a framework?
You call a library. A framework calls you. That reversal is called inversion of control.
A useful comparison from your own .NET world: Dapper is a library — you write the SQL and call it when you want. ASP.NET MVC is a framework — it owns the request pipeline and calls your controller action at the moment it decides.
| Library | Framework | |
|---|---|---|
| Who's in control | You | The framework |
| Structure | You decide | Prescribed |
| Freedom | High | Lower, but consistent |
| Examples | React, Dapper, Axios | Angular, ASP.NET Core, Spring |
The difference is inversion of control. With a library, your code is in charge and calls
the library when it needs it. With a framework, the framework is in charge and calls your
code at the points it defines. Dapper is a library, ASP.NET Core MVC is a framework —
and in the frontend, React is a library while Angular is a framework.
React vs Angular?
React is a flexible UI library where you assemble your own stack; Angular is a complete opinionated framework with everything already decided.
| React | Angular | |
|---|---|---|
| Type | Library (UI only) | Full framework |
| Language | JS or TypeScript | TypeScript (enforced) |
| Templates | JSX — markup inside JS | HTML templates + directives (*ngIf, *ngFor) |
| Data binding | One-way | Two-way available ([(ngModel)]) |
| DI | Not built in | Built-in dependency injection |
| Routing / HTTP | Separate packages | Built in |
| Async style | Promises / async-await | RxJS observables |
| Learning curve | Gentler start | Steeper — more concepts up front |
| Best for | Flexible apps, fast-moving teams | Large enterprise apps wanting one standard way |
Never say "React is better". Say what each is good at, then name a situation for each. A senior engineer picks tools for a context; a junior defends a favourite.
Angular is a complete framework — TypeScript, dependency injection, routing, HTTP and
RxJS all come in the box, with one prescribed way of doing things, which suits large
enterprise teams that want consistency. React is a UI library: it gives you components and
leaves routing, state and HTTP to you, so you get flexibility and a lighter learning curve
but you own the architecture decisions. I'd pick Angular where a large team needs one
enforced standard, and React where I want to move fast and shape the stack around the
product.