---
title: "Composables · vuejs.school"
description: "Pull stateful logic out of components into useSomething() functions that accept refs or getters and clean up after themselves."
canonical_url: "https://vuejs.school/learn/advanced/composables"
meta:
  "og:description": "Pull stateful logic out of components into useSomething() functions that accept refs or getters and clean up after themselves."
  "og:image": "https://vuejs.school/_og/d/a_~Q29tcG9zYWJsZXMgwrcgdnVlanMuc2Nob29s%2Cc_OgCard.takumi%2Ctitle_Composables%2Cdescription_Pull%2Bstateful%2Blogic%2Bout%2Bof%2Bcomponents%2Binto%2BuseSomething()%2Bfunctions%2Bthat%2Baccept%2Brefs%2Bor%2Bgetters%2Band%2Bclean%2Bup%2Bafter%2Bthemselves.%2Ceyebrow_~QWR2YW5jZWQgVnVlIMK3IExlc3NvbiAzIG9mIDEx%2Ctint_lilac%2Cp_Ii9sZWFybi9hZHZhbmNlZC9jb21wb3NhYmxlcyI%2Cs_tKigsDHT8zIkjEsn.png"
  "og:image:alt": "Composables · vuejs.school"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Composables · vuejs.school"
  "twitter:image": "https://vuejs.school/_og/d/a_~Q29tcG9zYWJsZXMgwrcgdnVlanMuc2Nob29s%2Cc_OgCard.takumi%2Ctitle_Composables%2Cdescription_Pull%2Bstateful%2Blogic%2Bout%2Bof%2Bcomponents%2Binto%2BuseSomething()%2Bfunctions%2Bthat%2Baccept%2Brefs%2Bor%2Bgetters%2Band%2Bclean%2Bup%2Bafter%2Bthemselves.%2Ceyebrow_~QWR2YW5jZWQgVnVlIMK3IExlc3NvbiAzIG9mIDEx%2Ctint_lilac%2Cp_Ii9sZWFybi9hZHZhbmNlZC9jb21wb3NhYmxlcyI%2Cs_tKigsDHT8zIkjEsn.png"
  "twitter:image:alt": "Composables · vuejs.school"
---

> Index of every page on this site: [llms.txt](https://vuejs.school/llms.txt)

# **Composables**

Pull stateful logic out of components into useSomething() functions that accept refs or getters and clean up after themselves.

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://vuejs.school/#website","@type":"WebSite","description":"A free AI-instructed school for Vue.js. Short tutorials, runnable code and quizzes that adapt to you.","name":"vuejs.school","url":"https://vuejs.school/","publisher":{"@id":"https://vuejs.school/#identity"}},{"@id":"https://vuejs.school/learn/advanced/composables#webpage","@type":"WebPage","description":"Pull stateful logic out of components into useSomething() functions that accept refs or getters and clean up after themselves.","name":"Composables","url":"https://vuejs.school/learn/advanced/composables","breadcrumb":{"@id":"https://vuejs.school/learn/advanced/composables#breadcrumb"},"isPartOf":{"@id":"https://vuejs.school/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://vuejs.school/learn/advanced/composables"]}],"primaryImageOfPage":{"@id":"https://vuejs.school/#logo"}},{"@id":"https://vuejs.school/#identity","@type":"Organization","description":"A free AI-instructed school for Vue.js. Short tutorials, runnable code and quizzes that adapt to you.","name":"vuejs.school","url":"https://vuejs.school","logo":{"@id":"https://vuejs.school/#logo"}},{"@id":"https://vuejs.school/learn/advanced/composables#article","description":"Pull stateful logic out of components into useSomething() functions that accept refs or getters and clean up after themselves.","headline":"Composables","inLanguage":"en","isAccessibleForFree":true,"thumbnailUrl":"https://vuejs.school/_og/d/a_~Q29tcG9zYWJsZXMgwrcgdnVlanMuc2Nob29s%2Cc_OgCard.takumi%2Ctitle_Composables%2Cdescription_Pull%2Bstateful%2Blogic%2Bout%2Bof%2Bcomponents%2Binto%2BuseSomething()%2Bfunctions%2Bthat%2Baccept%2Brefs%2Bor%2Bgetters%2Band%2Bclean%2Bup%2Bafter%2Bthemselves.%2Ceyebrow_~QWR2YW5jZWQgVnVlIMK3IExlc3NvbiAzIG9mIDEx%2Ctint_lilac%2Cp_Ii9sZWFybi9hZHZhbmNlZC9jb21wb3NhYmxlcyI%2Cs_tKigsDHT8zIkjEsn.png","@type":["Article","TechArticle"],"articleSection":["Composables"],"author":{"@id":"https://vuejs.school/#identity"},"image":{"@id":"https://vuejs.school/#/schema/image/1"},"isPartOf":{"@id":"https://vuejs.school/learn/advanced/composables#webpage"},"keywords":["composables","toValue()","MaybeRefOrGetter","onScopeDispose()"],"mainEntityOfPage":{"@id":"https://vuejs.school/learn/advanced/composables#webpage"},"publisher":{"@id":"https://vuejs.school/#identity"}},{"@id":"https://vuejs.school/learn/advanced/composables#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Skill tree","item":"https://vuejs.school/track","position":1},{"@type":"ListItem","name":"Advanced Vue","item":"https://vuejs.school/track/advanced","position":2},{"@type":"ListItem","name":"Composables","position":3}]},{"@id":"https://vuejs.school/#logo","@type":"ImageObject","caption":"vuejs.school","contentUrl":"https://vuejs.school/apple-touch-icon.png","inLanguage":"en","url":"https://vuejs.school/apple-touch-icon.png"},{"@id":"https://vuejs.school/#/schema/image/1","@type":"ImageObject","contentUrl":"https://vuejs.school/_og/d/a_~Q29tcG9zYWJsZXMgwrcgdnVlanMuc2Nob29s%2Cc_OgCard.takumi%2Ctitle_Composables%2Cdescription_Pull%2Bstateful%2Blogic%2Bout%2Bof%2Bcomponents%2Binto%2BuseSomething()%2Bfunctions%2Bthat%2Baccept%2Brefs%2Bor%2Bgetters%2Band%2Bclean%2Bup%2Bafter%2Bthemselves.%2Ceyebrow_~QWR2YW5jZWQgVnVlIMK3IExlc3NvbiAzIG9mIDEx%2Ctint_lilac%2Cp_Ii9sZWFybi9hZHZhbmNlZC9jb21wb3NhYmxlcyI%2Cs_tKigsDHT8zIkjEsn.png","inLanguage":"en","url":"https://vuejs.school/_og/d/a_~Q29tcG9zYWJsZXMgwrcgdnVlanMuc2Nob29s%2Cc_OgCard.takumi%2Ctitle_Composables%2Cdescription_Pull%2Bstateful%2Blogic%2Bout%2Bof%2Bcomponents%2Binto%2BuseSomething()%2Bfunctions%2Bthat%2Baccept%2Brefs%2Bor%2Bgetters%2Band%2Bclean%2Bup%2Bafter%2Bthemselves.%2Ceyebrow_~QWR2YW5jZWQgVnVlIMK3IExlc3NvbiAzIG9mIDEx%2Ctint_lilac%2Cp_Ii9sZWFybi9hZHZhbmNlZC9jb21wb3NhYmxlcyI%2Cs_tKigsDHT8zIkjEsn.png"}]}
```