Skip to content

Vue: components, reactivity and state

Vue is a progressive JavaScript framework for building user interfaces. “Progressive” means you can adopt as much of it as you need: sprinkle it onto a server-rendered page to make one widget interactive, or build a full single-page application with routing, state management and a build pipeline. It combines HTML-based templates that feel familiar to anyone who has written markup with a fine-grained reactivity system that updates exactly the parts of the page that depend on changed data.

A Vue app is a tree of components, usually written as single-file components (.vue files) that hold a component’s logic, template and styles together. Templates are compiled ahead of time into optimized render functions. State declared with ref, reactive and computed is tracked automatically: when it changes, Vue re-renders only the components that read it, so you rarely think about memoization.

  • Approachable. Templates are valid HTML with a small set of directives, so designers and back-end developers can read and contribute.
  • Scales from widgets to applications. The same component model works for a single interactive form and for a large SPA with Vue Router and Pinia.
  • Official ecosystem. Routing (Vue Router), state (Pinia), tooling (Vite, create-vue, Vue language tools) and DevTools are maintained by the core team and released together.
  • Two authoring styles. The Composition API with <script setup> (used throughout this section) and the Options API are both supported.

Vue’s templates are a separate syntax from JavaScript, so some logic that React expresses with plain JavaScript uses directives (v-if, v-for, v-model) instead. The ecosystem is smaller than React’s, though the official libraries cover the core needs.

As of November 2026:

Package Version Notes
vue 3.5 (3.5.45) 3.5 added reactive props destructure, useTemplateRef, onWatcherCleanup and a faster, leaner reactivity system. 3.6, with the opt-in Vapor Mode compiler, is in release-candidate stage.
pinia 4.1 Pinia 4 (July 2026) is ESM-only; the store API matches Pinia 3.
vue-router 5.5 The official router.

Create a project with npm create vue@latest, which scaffolds Vite, TypeScript, Vue Router, Pinia and test tooling as you choose.

Step Page What you get from it
1 Components and templates Single-file components, template syntax and directives, props, emits, defineModel and slots.
2 Reactivity and state ref and reactive, computed, watchers with cleanup, composables and Pinia stores.
Concept Where it is covered
<script setup>, interpolation, v-bind, v-on, v-if, v-for Single-file components and templates
defineProps, defineEmits, defineModel Props, emits and v-model
Named and scoped slots Slots
ref, reactive, toRefs Ref and reactive
Derived values Computed values
watch, watchEffect, onWatcherCleanup Watchers
Reusable logic Composables
App-wide state Shared state with Pinia
  • Compare the component model with React, which uses JSX and explicit state setters instead of templates and tracked reactivity.
  • Build the API behind a Vue front end with Node.js HTTP, Express and REST APIs.