Encapsulate Logic with Vue 3 Composable

Share this video with your friends

Send Tweet

A Vue composable is kind of like a React hook. They allow you to encapsulate your logic and reuse it throughout your applications.

In this lesson, we'll learn how to create a new composable, and use it with both a setup script and the object API.

Domenic Fiore
~ 2 years ago

So is a composable just a fancy term for an include/import? Maybe the difference will become clearer in the future but thought I'd ask in case it really is that simple.

Lucas Minter
~ 2 years ago

I think you're right. This is Vue's way of reusing stateful logic. https://vuejs.org/guide/reusability/composables.html