Vue 3 Reactivity: Q & A with Evan You
After learning how reactivity was written in Vue 2 and then in Vue 3 I was left with a couple of questions. Luckily, I had an opportunity to sit down with Evan You, the author of Vue, and ask him in person.
Questions we cover include:
- In Vue 2 Reactivity we used
dependandnotifyfor recording and playing back effects, and in Vue 3 we usetrackandtrigger, why the change? - In Vue 2 Reactivity
Depis a class with subscribers, and in Vue 3 dep is simply aSet. Why the change? - How did you end up with the
effectstorage solution in Vue 3? i.e.targetMapanddepsMap - Why use
Object Accessorswithrefrather than just re-usingreactive? - Using
Reflect&Proxyin Vue 3 allows us to add properties later that we want to be reactive, but what other benefits does this give us?