Category · 8 articles

Composables

Articles in the category Composables.

2024

1 entry

Vue Tip: When You Should Use a Composable

Vue composables are a way to encapsulate logic in a reusable way in Vue 3. They are a great way to share logic between components, but I often see them used in places where they are not needed.

Vue tip1 minScriptComposables

2023

6 entries

Vue Tip: Use Your Composables Synchronously

You should always call your composables synchronously in setup() hook or <script setup>. Otherwise Vue will not be able to determine the current active component instance and cannot correctly register features like lifecycle hooks, watchers, and computed properties.

Vue tip2 minScriptComposables

Vue Tip: Emit Event From Composable

Your application may contain a lot of components that are using the same logic, like emitting the same event. In this case, it might be tempting to create a composable that will emit this event and is used in all components. But how do you emit an event from inside a composable?

Vue tip2 minScriptComposables

2022

1 entry