Vue

A progressive framework with single-file components and fine-grained reactivity; approachable and popular in Asia and Europe.

Intermediate · about 12 hours · difficulty 3/5

Learn first: Declarative UI and Component Thinking

Vue is a progressive framework: you can sprinkle it onto a page or build a full single-page app. Its single-file components (.vue files) keep template, script and styles together, and its templates look like enhanced HTML, which many people find gentler than JSX.

Core concepts

  • Composition API with <script setup>: the modern way to write components.
  • Reactivity: ref() for single values (read with .value in script, unwrapped in templates) and reactive() for objects. Vue tracks what each component reads and re-renders only what changed.
  • computed() for derived values and watch() for side effects when data changes.
  • Template directives: v-if, v-for (with :key), v-bind (:), v-on (@) and v-model for two-way form binding.
  • Props and emits: defineProps and defineEmits, typed with TypeScript.
  • Slots: pass markup into child components.

Ecosystem

Vue Router for routing, Pinia for shared state, Vite (created by Vue's author) for tooling and Nuxt as the meta-framework.

Pitfalls

Destructuring a reactive object loses reactivity; forgetting .value in script code; mixing the Options API and Composition API styles inconsistently.

Good enough to move on

You can build the same catalogue-plus-cart app in Vue with the Composition API, Pinia for the cart and Vue Router for a product detail page.

Key concepts

  • Single-file components
  • Composition API and script setup
  • ref, reactive and computed
  • Template directives and v-model
  • Props, emits and slots
  • watch and lifecycle hooks
  • Pinia and Vue Router

Other options for this step

  • React: The most widely used UI library: JSX, components, props, state and events. Our recommended framework for your first job.
  • Angular: A batteries-included framework from Google with TypeScript, dependency injection and signals; common in enterprises.
  • Svelte: A compiler-based framework with runes for reactivity and very little boilerplate; small bundles and a joyful developer experience.

Mini project

Build a kanban board in Vue with draggable cards, a Pinia store persisted to localStorage and computed per-column counts.

Check yourself

Why does `const { count } = reactive({ count: 0 })` stop updating the UI, and how do toRefs or ref fix it?

Free resources