You’ve seen in the last tip “Use old instance properties in Composition API in Vue.js 3” how to access instance properties in the new syntax.

However, our beloved this.$refs wasn’t included in the setup context object as you realized if you read the tip.

So, how can you work with template refs in Composition API?

It might be more simple than you think! The thing is, Vue.js unifies the concept of refs, meaning that you just need to use the ref() function you already know for declaring reactive state variables in order to declare a template ref as well.

#vue #vue.js #vue.js 3 #api

Access template refs in Composition API in Vue.js 3
128.70 GEEK