RC
Getting Started Guide API Examples Community
  • Essentials
    • Hello world
  • App
    • Error Handling
    • Plugins
    • Teleport
  • Auto Imports
    • Components
    • Composables
  • Composables
    • useAsyncData
    • useCookie
    • useFetch
    • useHead
    • useState
  • Routing
    • Layouts
    • Middleware
    • <NuxtLink>
    • Pages
    • Universal Router
  • Server
    • Server Routes
  • Advanced
    • Config extends
    • Module Extend pages
    • Testing
  • Experimental
    • Reactivity Transform
    • Wasm
  • Other
    • Locale
  • Essentials
    • Hello world
  • App
    • Error Handling
    • Plugins
    • Teleport
  • Auto Imports
    • Components
    • Composables
  • Composables
    • useAsyncData
    • useCookie
    • useFetch
    • useHead
    • useState
  • Routing
    • Layouts
    • Middleware
    • <NuxtLink>
    • Pages
    • Universal Router
  • Server
    • Server Routes
  • Advanced
    • Config extends
    • Module Extend pages
    • Testing
  • Experimental
    • Reactivity Transform
    • Wasm
  • Other
    • Locale

Composables

This example shows how to use the composables/ directory to auto-import composables. If the component file provides a default export, the name of the composable will be mapped to the name of the file. Named exports can be used as-is.

👉
Read more in Guide > Directory Structure > Composables.
Loading Sandbox...

Auto Imports Components
Composables useAsyncData
Twitter GitHub

Nuxt 2 documentation