Pinia is now the officially recommended state manager for Vue 3. Earlier, Vuex was used officially. While Vuex still supports most of the Vue applications online, Pinia is the go-to…
How to create and use composables in Composition API in Vue.js | Example
Composables are one of the most exciting features of the Composition API in Vue 3. A composable in the Composition API is essentially an enhanced version of a mixin in…
Use provide/inject to pass props to deeply nested child components | Vue.js | Example
One of the ways to pass some data from parent to child components is through props. But how do we pass data from a parent to a really deeply nested…
Update parent state using update:modelValue in Composition API | Vue.js | Example
Earlier we've seen how we can use modelValue to react to a parent state in a child component. Now, let's have a look at how we can change the value…
How to use modelValue in a child component in Composition API in Vue.js | Example
We can v-model a value in the child component with the modelValue directly. Consider a button in the parent component bound with a boolean reactive state. This reactive state can…
Emit an event from child to parent component in Composition API in Vue.js | Example
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…