Passing some props from one component to another hasn't really changed in the Composition API. However, the way how we receive the props has changed. Consider the following example where…
How to import child components in Composition API in Vue 3 | Example
With the Composition API in Vue 3, importing and using child components has become much more easier than before. Consider an example where we have two components named ParentComponent.vue and…
How to use teleport in Vue.js 3 | Modal | Example
Teleport is by far one of my favorite additions to Vue 3. It is not specifically a Composition API feature. It means that we can use it even with the…
How to use nextTick() in Composition API in Vue.js | Example
nextTick allows us to wait untill the DOM has updated and then do something. In the Options API, we could access the nextTick through the global option this.$nextTick. However, this…
How to use ref in Composition API in Vue 3 | Example
Refs work a bit differently in Composition API as compared to the Options API. In the Options API, we could declare any element with a ref like this: <h1 ref="titleRef">…
How to use a global directive in Vue 3 Composition API | Example
Earlier I had written an article on how we can create and use custom directives in Options API in Vue.js. In this article, we'll see how we can define and…
How to create routes in Composition API in Vue.js | Example
The way routes and routers work haven't really changed much in Composition API. The changes are subtle and we can easily adapt to the new routing system. Here's an example…
How to use onUpdated in Composition API in Vue.js | Example
You can use the onUpdated lifecycle hook in Vue.js whenever there's been a re-render of the component. A re-render occurs whenever you make some changes to the reactive data you've…
How to use mounted() lifecycle hook in Composition API in Vue.js | Example
Composition API completely revamped the Options API with several improvements and changes. While these changes don't affect the template scope much, we certainly have a lot to deal with what…