Marc Backes

Under The Hood Of Vue 3 Reactivity

What if you could build Vue 3's reactivity from scratch? See how ES6 Proxies make it possible in under 30 lines of code.

Under The Hood Of Vue 3 Reactivity
#1about 3 minutes

Understanding the core principles of reactivity

Reactivity is explained as an automated observer pattern where changes to data trigger updates wherever that data is used.

#2about 2 minutes

Using ES6 Proxies to intercept data access

ES6 Proxies wrap objects and allow interception of operations like getting or setting properties, which is the foundation for Vue 3's reactivity.

#3about 4 minutes

Architecting the reactivity system with maps and sets

The system uses a WeakMap to store a Map for each object, which in turn stores a Set of effects for each property.

#4about 5 minutes

Demonstrating the problem with manual state updates

The initial code shows how changing a product's price or quantity requires manually recalculating the total each time.

#5about 3 minutes

Building manual track and trigger functions

The `track` function adds an effect to a Set, and the `trigger` function iterates over the Set to execute all tracked effects.

#6about 11 minutes

Building a reactive function with ES6 Proxies

A `reactive` function is created using an ES6 Proxy to intercept property access, with `get` handlers calling `track` and `set` handlers calling `trigger`.

#7about 4 minutes

Automating dependency tracking with an effect function

The `effect` function wraps a piece of code, sets it as the `activeEffect`, and runs it once to automatically track all accessed reactive properties.

#8about 6 minutes

Connecting the reactive system to the DOM

The final step demonstrates the complete system by linking the reactive state to DOM elements, which update automatically when the state changes.

#9about 12 minutes

Answering audience questions about reactivity and career

The speaker answers questions about proxy performance, nested objects, career journey, and identifying reactive objects in a large codebase.

Related jobs
Jobs that call for the skills explored in this talk.

job ad

Saby Company
Delebio, Italy

Intermediate

d

Saby Company
Delebio, Italy

Junior

Featured Partners

Related Articles

View all articles
CH
Chris Heilmann
WeAreDevelopers LIVE days are changing - get ready to take part
Starting with this week's Web Dev Day edition of WeAreDevelopers LIVE Days, we changed the the way we run these online conferences. The main differences are:Shorter talks (half an hour tops)More interaction in Q&AA tips and tricks "Did you know" sect...
WeAreDevelopers LIVE days are changing - get ready to take part
CH
Chris Heilmann
Dev Digest 136 - No JS(on) of mine
News and ArticlesDouglas Crockford is our featured video, so let's talk about evolving JavaScript and all things JSON. Judicious JSON explains all the weird things in it, you can learn why it can be incredibly slow, people wonder what even is a JSON ...
Dev Digest 136 - No JS(on) of mine
LM
Luis Minvielle
The Best 7 Frontend Frameworks for Developers in 2025
Which frontend frameworks should developers focus on in 2025? We’re listing them for you and showing advantages and drawbacks. You’ll notice we included some libraries as well, because you can’t miss those in 2025.What is the best front end framework...
The Best 7 Frontend Frameworks for Developers in 2025
LM
Luis Minvielle
10 Developer Websites in 2023
As a web developer, you're always investigating how to level up your skills and streamline your workflow. That's why we've gathered a collection of 10 innovative tools that are guaranteed to boost your productivity, enhance your coding abilities, ele...
10 Developer Websites in 2023

From learning to earning

Jobs that call for the skills explored in this talk.