@angular/core, react, svelte, and vue are the four dominant forces in modern frontend development, each offering a distinct approach to building user interfaces. @angular/core provides a comprehensive, opinionated framework with built-in solutions for routing, HTTP, and state management, relying heavily on TypeScript and decorators. react is a library focused on the view layer, utilizing a virtual DOM and a functional component model driven by hooks to manage state and side effects. svelte shifts the workload to compile time, generating highly optimized imperative code that updates the DOM directly without a virtual DOM. vue offers a progressive framework that blends the flexibility of React's component model with an intuitive template syntax and a reactive system based on proxies.
When architecting a modern web application, the choice of core library dictates not just how you write code, but how you think about data flow, performance, and scalability. @angular/core, react, svelte, and vue all solve the same fundamental problem β keeping the UI in sync with state β but they employ vastly different mechanisms to achieve it. Let's dive into the technical realities of how each handles reactivity, component structure, and side effects.
The core difference lies in how these tools detect changes and update the screen.
react relies on a Virtual DOM. When state changes, React re-runs the component function to create a new lightweight tree of objects. It then compares this new tree with the previous one (a process called "diffing") to calculate the minimal set of changes needed for the real DOM.
// react: State triggers a re-render of the whole component function
function Counter() {
const [count, setCount] = useState(0);
// Every time setCount is called, this function runs again
return <button onClick={() => setCount(count + 1)}>{count}</button>;
}
@angular/core uses Zone.js (or signals in newer versions) to detect asynchronous operations. By default, it runs change detection on the entire component tree when an event occurs, though developers can optimize this using OnPush strategy to check only when inputs change.
// @angular/core: Change detection runs automatically
@Component({
selector: 'app-counter',
template: `<button (click)="count = count + 1">{{ count }}</button>`
})
export class CounterComponent {
count = 0;
// Angular detects the click event and triggers change detection
}
svelte moves the work to compile time. The compiler analyzes your code and generates specific JavaScript instructions that update the DOM directly when a variable changes. There is no virtual DOM and no runtime diffing.
<!-- svelte: Compiler generates direct DOM updates -->
<script>
let count = 0;
// No special function needed; assigning to 'count' triggers an update
</script>
<button on:click={() => count++}>
{count}
</button>
vue utilizes a reactivity system based on Proxies (in Vue 3). It tracks which properties are accessed during rendering and automatically re-runs the specific components that depend on that data when it changes.
<!-- vue: Reactivity via Proxies -->
<script setup>
import { ref } from 'vue';
const count = ref(0);
// Accessing .value tracks the dependency; changing it triggers updates
</script>
<template>
<button @click="count++">{{ count }}</button>
</template>
How you define the UI structure varies significantly, impacting tooling and developer workflow.
react uses JSX, which embeds HTML-like syntax directly inside JavaScript. This gives you the full power of JavaScript logic within your markup but requires a build step to transform it.
// react: Logic and markup mixed in JSX
function UserCard({ user }) {
return (
<div className="card">
<h2>{user.isActive ? "Active User" : "Inactive"}</h2>
<p>{user.email}</p>
</div>
);
}
@angular/core uses HTML templates with a specialized syntax for binding and directives. This keeps logic mostly separate from the view, enforced by TypeScript classes.
// @angular/core: Template with binding syntax
@Component({
template: `
<div class="card">
<h2>{{ user.isActive ? 'Active User' : 'Inactive' }}</h2>
<p>{{ user.email }}</p>
</div>
`
})
export class UserCardComponent {
@Input() user!: User;
}
svelte uses a single-file component format that looks like standard HTML but adds script and style blocks. The syntax is minimal and close to native web standards.
<!-- svelte: Standard HTML with enhanced script -->
<script>
export let user;
</script>
<div class="card">
<h2>{user.isActive ? 'Active User' : 'Inactive'}</h2>
<p>{user.email}</p>
</div>
vue also uses Single-File Components (SFCs) with a template section that supports an HTML-based syntax with Vue-specific directives.
<!-- vue: Template with directives -->
<template>
<div class="card">
<h2>{{ user.isActive ? 'Active User' : 'Inactive' }}</h2>
<p>{{ user.email }}</p>
</div>
</template>
<script setup>
defineProps(['user']);
</script>
Handling data fetching, subscriptions, and DOM manipulation requires different patterns in each ecosystem.
react uses the useEffect hook to handle side effects. You must manually specify dependencies to ensure the effect runs only when necessary, which can be a source of bugs if misunderstood.
// react: useEffect handles side effects
function UserProfile({ userId }) {
const [user, setUser] = useState(null);
useEffect(() => {
fetch(`/api/users/${userId}`).then(res => res.json()).then(setUser);
}, [userId]); // Runs only when userId changes
return <div>{user?.name}</div>;
}
@angular/core relies on lifecycle interfaces like ngOnInit and ngOnDestroy. Developers often use RxJS observables to manage streams of data and unsubscribe manually or via the async pipe.
// @angular/core: Lifecycle hooks and RxJS
export class UserProfileComponent implements OnInit, OnDestroy {
user: User | null = null;
private sub: Subscription | undefined;
constructor(private userService: UserService) {}
ngOnInit() {
this.sub = this.userService.getUser(this.userId).subscribe(u => this.user = u);
}
ngOnDestroy() {
this.sub?.unsubscribe();
}
}
svelte provides a simple onMount function for logic that needs to run after the component renders to the DOM. Cleanup is handled by returning a function from onMount.
<!-- svelte: onMount for side effects -->
<script>
import { onMount } from 'svelte';
let user;
onMount(async () => {
const res = await fetch(`/api/users/${userId}`);
user = await res.json();
// Return a cleanup function if needed
return () => console.log('Component unmounted');
});
</script>
vue uses the onMounted hook within the Composition API. It offers a straightforward way to run logic after the initial render, similar to React but with less boilerplate around dependency arrays.
<!-- vue: onMounted hook -->
<script setup>
import { ref, onMounted } from 'vue';
const user = ref(null);
onMounted(async () => {
const res = await fetch(`/api/users/${userId}`);
user.value = await res.json();
});
</script>
Despite their architectural differences, these frameworks share several core concepts that make modern frontend development possible.
All four encourage breaking UIs into small, reusable, and isolated components. This promotes modularity and easier testing.
// react: Functional component
const Button = ({ label }) => <button>{label}</button>;
// @angular/core: Class-based component
@Component({ selector: 'app-button', template: '<button>{{ label }}</button>' })
export class ButtonComponent { @Input() label!: string; }
<!-- svelte: Component file -->
<script> export let label; </script>
<button>{label}</button>
<!-- vue: Component definition -->
<script setup> defineProps(['label']); </script>
<template><button>{{ label }}</button></template>
While implemented differently, all support syncing form inputs with state variables.
// react: Controlled components
<input value={name} onChange={e => setName(e.target.value)} />
// @angular/core: ngModel directive
<input [(ngModel)]="name" />
<!-- svelte: bind directive -->
<input bind:value={name} />
<!-- vue: v-model directive -->
<input v-model="name" />
Each framework provides a declarative way to show or hide elements based on state.
// react: JavaScript logic
{isLoggedIn ? <Dashboard /> : <Login />}
// @angular/core: *ngIf directive
<dashboard *ngIf="isLoggedIn"></dashboard>
<login *ngIf="!isLoggedIn"></login>
<!-- svelte: if block -->
{#if isLoggedIn}
<Dashboard />
{:else}
<Login />
{/if}
<!-- vue: v-if directive -->
<dashboard v-if="isLoggedIn" />
<login v-else />
| Feature | @angular/core | react | svelte | vue |
|---|---|---|---|---|
| Reactivity | Zone.js / Signals | Virtual DOM | Compile-time | Proxy-based |
| Syntax | HTML + TS Classes | JSX (JS) | HTML + Script | HTML + Script |
| Learning Curve | Steep (Opinionated) | Moderate (Flexible) | Gentle (Intuitive) | Gentle (Progressive) |
| Bundle Size | Larger (Framework) | Small (Library) | Tiny (No Runtime) | Small (Runtime) |
| State Management | Services / RxJS | Context / Redux / Zustand | Stores / Context | Pinia / Vuex |
| Ecosystem | All-in-One | Massive & Fragmented | Growing & Simple | Balanced & Integrated |
@angular/core is the heavy-duty enterprise choice. It provides a complete solution out of the box, enforcing strict patterns that help large teams stay aligned. If you need a framework that dictates architecture and includes everything from HTTP clients to testing utilities, this is it.
react is the flexible powerhouse. It gives you the tools to build anything but leaves the architectural decisions up to you. Its massive ecosystem means there is a library for every use case, but this also requires careful selection to avoid bloat. It shines in complex, interactive applications where custom logic is king.
svelte is the developer-friendly innovator. By removing the virtual DOM and shifting complexity to the compiler, it offers incredible performance and a very clean coding experience. It is perfect for projects where speed (both in development and runtime) is critical and you want to avoid the boilerplate of larger frameworks.
vue is the balanced pragmatist. It offers the best of both worlds: the structure of a framework with the flexibility of a library. Its gentle learning curve makes it easy to pick up, while its advanced features support complex applications. It is an excellent choice for teams transitioning from jQuery or legacy systems, as well as for greenfield projects requiring rapid iteration.
Final Thought: There is no single "best" framework. The right choice depends on your team's expertise, the scale of your project, and your specific performance requirements. All four are capable of building world-class applications when used correctly.
Choose vue if you want a balanced approach that offers the structure of a framework with the flexibility of a library. It is particularly well-suited for migrating legacy applications due to its gentle learning curve and ability to be incrementally adopted. The separation of concerns in single-file components and the robust reactivity system make it a great choice for both small prototypes and complex enterprise applications.
Choose @angular/core for large-scale enterprise applications where strict architecture, strong typing, and a unified ecosystem are critical. It is ideal for teams that prefer a 'batteries-included' approach with built-in solutions for routing, forms, and HTTP, reducing the need to evaluate third-party libraries. The steep learning curve is justified by the long-term maintainability and consistency it enforces across massive codebases.
Choose react if you need maximum flexibility, a vast ecosystem of third-party libraries, or plan to build cross-platform applications using React Native. It is the best fit for teams comfortable managing their own architectural decisions regarding state management and routing, preferring a 'learn once, write anywhere' philosophy. Its functional component model and hooks system offer a powerful way to reuse logic across different parts of an application.
Choose svelte when performance and bundle size are top priorities, or when you want to write less boilerplate code without sacrificing reactivity. It is excellent for projects where developer experience is paramount, as it eliminates the need for a virtual DOM and complex state management libraries by handling reactivity at compile time. This makes it a strong candidate for interactive dashboards, media-heavy sites, or teams wanting to move fast with minimal configuration.
vue(.runtime).global(.prod).js:
<script src="..."> in the browser. Exposes the Vue global.<script src="...">.vue.global.js is the "full" build that includes both the compiler and the runtime so it supports compiling templates on the fly.vue.runtime.global.js contains only the runtime and requires templates to be pre-compiled during a build step.*.prod.js files for production.vue(.runtime).esm-browser(.prod).js:
<script type="module">).vue(.runtime).esm-bundler.js:
webpack, rollup and parcel.process.env.NODE_ENV guards (must be replaced by bundler)@vue/runtime-core, @vue/compiler-core)
esm-bundler builds and will in turn import their dependencies (e.g. @vue/runtime-core imports @vue/reactivity)vue.runtime.esm-bundler.js (default) is runtime only, and requires all templates to be pre-compiled. This is the default entry for bundlers (via module field in package.json) because when using a bundler templates are typically pre-compiled (e.g. in *.vue files).vue.esm-bundler.js: includes the runtime compiler. Use this if you are using a bundler but still want runtime template compilation (e.g. in-DOM templates or templates via inline JavaScript strings). You will need to configure your bundler to alias vue to this file.Detailed Reference on vuejs.org
esm-bundler builds of Vue expose global feature flags that can be overwritten at compile time:
__VUE_OPTIONS_API__
true__VUE_PROD_DEVTOOLS__
false__VUE_PROD_HYDRATION_MISMATCH_DETAILS__
falseThe build will work without configuring these flags, however it is strongly recommended to properly configure them in order to get proper tree-shaking in the final bundle.
vue.cjs(.prod).js:
require().target: 'node' and properly externalize vue, this is the build that will be loaded.process.env.NODE_ENV.