composable
A Vue composable encapsulates reusable stateful logic through the Composition API.
Use this when Vue components repeat subscriptions or asynchronous behavior.
without the term
“Several Vue components repeat the same fetch and window-resize logic. Can you pull it into something reusable that cleans up after itself?”
with the term · How do you ask a model for composable?
Extract this Vue behavior into a composable. Verify independent consumers and that subscriptions are removed when a consumer unmounts.
What is composable?
A composable is a function that uses Vue's Composition API to package reactive state and lifecycle logic for reuse. It decides explicitly whether state is per caller or shared.
Why does composable matter when vibe coding?
Moving code into a function can leave listeners alive after its consumer disappears.
How do you do composable?
Define whether state is local or shared and use the appropriate lifecycle cleanup.
What goes wrong with composable?
Translating a React Hook mechanically without checking Vue’s reactivity rules.