How it works · JavaScript framework for building screens

How Vue works

Vue notices which data each part of the screen reads, so when that data changes it knows exactly what to redraw.

Think of it like this. A spreadsheet: change one cell, and only the cells that use it recalculate.

  1. Reactivity Wraps your data so that reading it and changing it can both be noticed. packages/reactivity
  2. The compiler Turns a template into a JavaScript function that draws it. packages/compiler-core
  3. The renderer Runs those functions, compares the result with last time, and works out the changes. packages/runtime-core
  4. The DOM layer Makes the real edits to the page: create an element, set a property. packages/runtime-dom
  5. Single-file components Splits a .vue file into its template, script and styles. packages/compiler-sfc

Follow one thing through: A button runs count.value++

  1. Setting the value is noticed, because count is a ref with a setter.packages/reactivity/src/ref.ts
  2. Everything that read count while it was drawing gets told. Here, one component.packages/reactivity/src/dep.ts
  3. The component’s update is put in a queue, once, however many times count changes.packages/runtime-core/src/scheduler.ts
  4. A moment later the queue is flushed and the component’s draw function runs again.packages/runtime-core/src/renderer.ts
  5. The new result is compared with the old one.packages/runtime-core/src/renderer.ts
  6. One piece of text is different, so one piece of text is changed on the page.packages/runtime-dom/src/nodeOps.ts

The clever bit: It tracks what you read

You never tell Vue what a component depends on. While a component is drawing, every read of reactive data is recorded: this component used that value. Later, a write looks up who read it and reruns just those. The list is rebuilt on every draw, so it is never out of date.

packages/reactivity/src/dep.ts

Words you’ll meet

ref
A box around one value. Reading and writing its .value is what Vue watches.
reactive
An object wrapped so that reads and writes to any property are noticed.
virtual DOM
A light description of what the screen should be, compared with the last one to find changes.
nextTick
Waiting until Vue has finished applying the queued updates.

Good questions to ask next

Open Vue in Bento and ask them there. It reads the project in your browser, draws its parts as a map you can press, and opens the real code behind each one.

Take Vue apart yourself.

Free and open source. Nothing to install, no account.

More projects, taken apart

Written by hand from the code as it was on 2026-12-04 (commit ad81e54). Vue belongs to its authors; this page is an independent explanation. Spot a mistake? Tell us.