2022-03-30 15:59:28 +00:00
|
|
|
---
|
|
|
|
template: Example
|
|
|
|
---
|
|
|
|
|
2022-04-06 05:56:08 +00:00
|
|
|
# `useAsyncData`
|
2022-03-30 15:59:28 +00:00
|
|
|
|
|
|
|
This example shows how to use `useAsyncData` to fetch data from an API endpoint.
|
|
|
|
|
|
|
|
::alert{type=info icon=💡}
|
2022-04-16 13:53:36 +00:00
|
|
|
Nuxt will automatically read files in the `~/server/api` directory to create API endpoints.
|
2022-03-30 15:59:28 +00:00
|
|
|
::
|
|
|
|
|
2022-04-06 05:56:08 +00:00
|
|
|
::ReadMore{link="/api/composables/use-async-data"}
|
|
|
|
::
|
|
|
|
|
2022-09-13 12:54:31 +00:00
|
|
|
::ReadMore{link="/getting-started/data-fetching"}
|
2022-03-30 15:59:28 +00:00
|
|
|
::
|
|
|
|
|
|
|
|
::sandbox{repo="nuxt/framework" branch="main" dir="examples/composables/use-async-data" file="app.vue"}
|