Frontend framework comparison
React vs Angular
React is a lean UI library built by Meta that you compose into a full architecture. Angular is a complete, opinionated framework built by Google that makes most architectural decisions for you. Understanding the difference — and the vocabulary around it — is essential for any front-end developer.
TL;DR
- React — UI library, not a framework. Handles rendering via JSX and a virtual DOM. You choose your own router, state manager, and data-fetching layer. Lower entry barrier, more architectural freedom, larger job market.
- Angular — full framework. Bundles routing, forms, HTTP client, dependency injection, and RxJS out of the box. TypeScript is mandatory. Steeper learning curve; stronger consistency across large codebases.
- Neither is universally better. React dominates in product companies and startups; Angular is common in enterprise and government applications where enforced conventions matter more than flexibility.
Side-by-side comparison
| Aspect | React | Angular |
|---|---|---|
| Type | UI library (view layer only) | Full framework (routing, DI, HTTP, forms) |
| Language | JavaScript or TypeScript (optional) | TypeScript (mandatory) |
| Templates | JSX — JavaScript with embedded markup | HTML templates with Angular directives |
| DOM strategy | Virtual DOM diffing | Zone-based change detection (signals in v17+) |
| Data flow | One-way; explicit onChange handlers | One-way by default; [(ngModel)] for two-way |
| State management | useState / useReducer + external libs (Redux, Zustand) | Services + RxJS BehaviorSubject / NgRx |
| Dependency injection | Not built-in; Context or third-party libs | Hierarchical DI container — core feature |
| Learning curve | Moderate — JSX and hooks are accessible | Steep — TypeScript, decorators, RxJS, NgModules |
| Bundle (minimal app) | ~40 kB gzipped (React + ReactDOM) | ~130 kB+ gzipped |
| Best for | SPAs, startups, Next.js apps, broad hiring pool | Enterprise dashboards, large teams, enforced conventions |
What is React?
React is a JavaScript library for building user interfaces, released by Meta (formerly Facebook) in 2013. It is responsible for one thing: rendering UI components efficiently and re-rendering them when state changes.
React's key design choice is the virtual DOM — an in-memory representation of the real DOM. When a component's state changes, React builds a new virtual DOM tree, diffs it against the previous one, and applies only the minimum set of actual DOM mutations required. This keeps updates fast without the developer having to think about manual DOM manipulation.
Since React 16.8, the recommended way to write components is with hooks — functions prefixed with use that give function components access to state, side-effects, and shared logic. useState manages local state, useEffect handles side-effects such as data fetching, and useContext reads shared values without prop-drilling.
Because React only covers the view layer, you must choose companion libraries: React Router for navigation, Redux or Zustand for global state, and React Query or SWR for server data. This flexibility is both React's strength and the source of the infamous "decision fatigue" newcomers encounter.
React works with plain JavaScript but the ecosystem has largely standardised on TypeScript. When used with Next.js, React supports both client-side and server-side rendering, including React Server Components.
What is Angular?
Angular is a full-featured, opinionated framework for building web applications, maintained by Google. Version 2+ (simply called "Angular") was a complete rewrite of the original AngularJS and was released in 2016. It is TypeScript-first — the framework is written in TypeScript and the tooling assumes TypeScript throughout.
Angular includes everything a production application needs: a CLI for scaffolding, a router, an HTTP client, a forms module (both template-driven and reactive), a dependency injection container, and built-in test harnesses. Developers do not choose these — they are bundled, versioned, and upgraded together by the Angular team.
The framework's most distinctive feature is its hierarchical dependency injection (DI) system. Services are decorated with @Injectable() and registered in a module or component. Angular resolves and injects them automatically, managing their lifetimes and scopes. This pattern is familiar to developers coming from Java Spring or .NET.
Angular also embraces RxJS (Reactive Extensions for JavaScript) throughout — the HTTP client returns Observables, the Router exposes Observables, and forms emit value streams. RxJS is powerful for complex async flows but adds a significant learning curve. Angular 17 introduced a simpler Signals API as a more approachable reactivity model for teams less familiar with reactive programming.
Two-way data binding with [(ngModel)] is one of Angular's headline features for forms — changing a form field updates the bound variable, and updating the variable from code updates the field. React achieves the same outcome with explicit event handlers, which is more verbose but easier to trace.
Key differences explained
Library vs framework
The most fundamental distinction: React is a library — you call it when you need it. Angular is a framework — it provides the structure, and your code fills in the logic. In practice, this means a React app is an assembly of individually chosen packages, while an Angular app is built inside Angular's conventions.
Virtual DOM vs zone-based change detection
React's virtual DOM diffs component trees to determine what changed. Angular historically used Zone.js to monkey-patch browser APIs (setTimeout, fetch, etc.) and trigger change detection cycles when async operations complete. Angular 17+ introduces Signals, which track reactive state at a finer granularity and should make Zone.js optional in future versions.
TypeScript: optional vs mandatory
React is language-agnostic — you can use JavaScript or TypeScript. Angular is TypeScript-mandatory. For teams already invested in TypeScript, Angular's consistency is an advantage. For teams preferring gradual adoption, React's flexibility is appealing. See our TypeScript vs JavaScript comparison for more context.
Component architecture and modules
Both frameworks are component-based — UIs are built from isolated, reusable pieces. React components are functions (or classes) that return JSX. Angular components are TypeScript classes decorated with @Component(), paired with an HTML template and a CSS file. Angular 14+ introduced standalone components that do not require NgModules, reducing boilerplate significantly.
Ecosystem and opinionation
React's npm ecosystem is vast and fragmented — there are dozens of competing router, state, and form libraries. Angular's ecosystem is smaller but more cohesive — the Angular team controls the core tools and publishes an upgrade path between major versions. Teams who value one canonical way to do things tend to prefer Angular; teams who want to pick the best tool for each sub-problem tend to prefer React.
Code examples: the same component in each
A simple counter component to illustrate the syntax difference:
React (with hooks)
import { useState } from 'react';
export function Counter() {
const [count, setCount] = useState(0);
return (
<div>
<p>Count: {count}</p>
<button onClick={() => setCount(count + 1)}>Increment</button>
</div>
);
} Angular (standalone component)
import { Component, signal } from '@angular/core';
import { CommonModule } from '@angular/common';
@Component({
selector: 'app-counter',
standalone: true,
imports: [CommonModule],
template: `
<div>
<p>Count: {{ count() }}</p>
<button (click)="increment()">Increment</button>
</div>
`,
})
export class CounterComponent {
count = signal(0);
increment() { this.count.update(n => n + 1); }
} How engineers talk about React vs Angular
These phrases come up regularly in code reviews, architecture discussions, and technical interviews.
React conversations
- "We lift state up to the nearest common parent so both components can read it."
- "This component re-renders on every parent update — wrap it in
React.memoto bail out if props haven't changed." - "The useEffect hook fires after every render unless we provide a dependency array."
- "We use Context here to avoid prop-drilling through five layers of components."
- "The page uses Server Components for the initial data fetch, so that logic never ships to the client."
- "We've hit stale closure issues inside the effect — the handler captures an old value of count."
Angular conversations
- "The service is injected via the constructor — standard DI; don't instantiate it directly."
- "We return an Observable from the HTTP client and subscribe in the component; remember to unsubscribe on destroy."
- "The form uses Reactive Forms with validators; template-driven forms wouldn't scale here."
- "We lazy-load the admin module so it's excluded from the initial bundle."
- "Set the change detection strategy to OnPush — the component only updates when its inputs change."
- "With Angular Signals we can drop Zone.js and get fine-grained reactivity without the overhead."
Decision guide: which should you choose?
- Building with Next.js or Remix → React
- Want maximum architectural flexibility → React
- Large enterprise team needing enforced conventions → Angular
- Team already fluent in TypeScript and RxJS → Angular
- Need strong built-in form validation and reactive forms → Angular
- Hiring from the broadest talent pool → React (significantly more React developers on the market)
- Prefer one official answer for every architectural question → Angular
- Project has complex real-time data streams → Angular + RxJS or React + RxJS/Signals
- Building a static site or lightweight SPA → React (smaller baseline bundle)
- Team is split and undecided → React is the lower-risk default; easier to hire for and easier to exit
Key vocabulary
- Library vs framework
- A library is code you call; a framework is code that calls you. React is a library — you import and use it where needed. Angular is a framework — it provides the application structure and your code plugs in.
- Virtual DOM
- An in-memory JavaScript object representing the actual DOM tree. React builds a new virtual DOM on every state change, diffs it against the previous version, and applies only the changed nodes to the real DOM — minimising expensive browser repaints.
- Two-way binding
- Automatic synchronisation between a UI element and a JavaScript variable. Angular's
[(ngModel)]syntax enables it natively. React achieves the same outcome explicitly through controlled components with onChange handlers. - Dependency Injection (DI)
- A design pattern where an object receives its dependencies from an external container rather than creating them itself. Angular's DI container manages service instantiation, lifetime, and scope hierarchy.
- RxJS / Observables
- RxJS (Reactive Extensions for JavaScript) is a library for handling asynchronous data streams using the Observable pattern. Angular uses it extensively — HTTP responses, router events, and form value changes are all Observables.
- Hook
- A React function prefixed with
use(e.g.useState,useEffect,useContext) that gives function components access to state, lifecycle behaviour, and shared logic without writing class components. - Component-based architecture
- Both React and Angular build UIs from self-contained components — isolated units of UI, logic, and optionally styling. Components can be composed, reused, and tested independently.
- Opinionated vs flexible
- An opinionated framework (Angular) prescribes how to solve common problems, reducing decisions but limiting freedom. A flexible library (React) leaves those decisions to the team, enabling customisation at the cost of more upfront choices.
Frequently asked questions
What is the fundamental difference between React and Angular?
React is a UI library — it handles the view layer (rendering components) and lets you choose your own routing, state management, and data-fetching libraries. Angular is a complete opinionated framework that bundles routing, forms, HTTP client, dependency injection, and a CLI, all integrated and maintained by the Angular team. The practical result: React gives you more freedom but more decisions; Angular gives you less freedom but more out-of-the-box consistency.
Is Angular harder to learn than React?
Generally yes. Angular requires understanding TypeScript, decorators, NgModules, services, hierarchical dependency injection, and RxJS Observables before you can build productively. React's core concepts — JSX and hooks — are more accessible. That said, Angular's opinionated structure means large teams often find it easier to maintain consistency at scale, because there is only one way to do routing, DI, and HTTP.
Does React require TypeScript?
No. React works with plain JavaScript or TypeScript. TypeScript is increasingly the community default for new React projects, but it remains optional and can be adopted incrementally. Angular, by contrast, is TypeScript-first — the framework itself is written in TypeScript and the tooling assumes TypeScript throughout. You can technically write Angular in JavaScript, but it is not recommended.
What is two-way data binding and does React support it?
Two-way data binding automatically synchronises a form input with a JavaScript variable — changing the input updates the variable, and changing the variable updates the input. Angular supports this natively with the [(ngModel)] syntax. React uses one-way data flow: you manage state changes explicitly with onChange event handlers and setState or a state hook. React's approach is more predictable and easier to debug; Angular's two-way binding reduces form boilerplate.
What is virtual DOM and does Angular use it?
The virtual DOM is a lightweight in-memory representation of the actual DOM. React uses it to batch and minimise direct DOM updates — when state changes, React diffs the new virtual DOM against the previous one and applies only the necessary real DOM changes. Angular does not use a virtual DOM. Instead, it uses a zone-based change detection system (Zone.js) that tracks asynchronous operations and re-checks component bindings when something might have changed. Angular 17+ also introduced a new signals-based reactivity model that avoids zone overhead entirely.
How does dependency injection work in Angular compared to React?
Angular ships a hierarchical DI container built into the framework. You declare services with @Injectable(), register them in a module or component provider list, and Angular automatically resolves and injects them via constructor parameters. React has no built-in DI system. Patterns like Context, custom hooks, or third-party libraries (InversifyJS, tsyringe) can achieve similar goals, but each team chooses its own approach.
Which is better for enterprise applications?
Angular is historically favoured for large enterprise teams because its opinionated structure — one canonical way to do routing, DI, and HTTP — enforces consistency across large codebases and makes onboarding more predictable. React is also widely used at enterprise scale (Meta, Airbnb, Netflix) but requires teams to define and enforce their own architectural conventions. The choice often comes down to existing team experience and organisational standards.