Using @vue/compat, the beforeCreate hook in proxy.ts throws an exception:
this.$refs = new Proxy(...)
TypeError: 'set' on proxy: trap returned falsish for property
My Vue 3 fix is to change the hook to this:
beforeCreate() {
this.$.refs = reactive({});
}
Note the period between the ‘$’ and the ‘refs’.
I swore I read somewhere that $refs was going to be reactive in Vue 3, but it seems not to be. Maybe I just imagined it…
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Vue.js - The Progressive JavaScript Framework | Vue.js
Approachable. Builds on top of standard HTML, CSS and JavaScript with intuitive API and world-class documentation. · Performant. Truly reactive, compiler- ...
Read more >Vue 3 – A roundup of infos about the new version of Vue.js
Vue 3 features & changes. As Evan You summarized it, Vue 3 is faster, smaller, more maintainable and it's easier to target native....
Read more >vuejs/core: Vue.js is a progressive, incrementally ... - GitHub
Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web. - GitHub - vuejs/core: Vue.js is a progressive, ...
Read more >What's new in Vue 3 — a roundup. Vue 3 - Medium
Vue 3 introduced the Composition API as an alternative method to the Options API for writing component states and logic. It's simply a...
Read more >A definitive guide to Vue 3 components - LogRocket Blog
Vue apps consist of components, which are reusable pieces of UI code that build functional and complex web applications.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

It is so easy to get reactive refs in Vue 3 that a plugin isn’t really justified. I recommend that you simply include the following
beforeCreatehook in any component which depends on reactive refs:If you want reactive refs in every component automatically, add the hook globally:
Can it be fixed?