Learn Vue JS course Learn Javascript and Vue JS Learn VueJS course Learn VueJS Tutorial

Vue 3 Composition API

Using Vue Router with Composition API thumbnail image

Get access to the most comprehensive Vue.js video library in the world. Over 300 video lessons including the newest Vue 3 features.

Using Vue Router with Composition API

In this lesson we learn how to access the Vue Router route and router objects from inside the setup function. Since setup() is called before other component options are resolved the this keyword does not reference the component instance as it does within the Options API. Therefore we can use composables provided by Vue Router to access route and router. This is a common pattern utilized by third party libraries to integrate with the composition API.

Links