We can use emit to emit some events in the parent component from the child component. This is highly useful when we want to update some state or call a…
How to use slots in Composition API in Vue.js 3 | Example
Slots are a great way to pass some fixed data from the parent to the child component. We can then arrange the position and appearance of the data wherever and…
How to pass and receive props in Composition API in Vue.js | Example
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…
Remove polygons on click in Google Maps JavaScript API | Vue.js | Example
Earlier we've seen how we can create polygons with labels, create editable polygons, and highlight polygons on hover in Google Maps JavaScript API v3 using Vue.js. Today we'll see how…
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…
