@nuxt/docs-nightly 4.0.0-29207326.36a6df78 → 4.0.0-29207363.f34c6c24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -142,6 +142,10 @@ const { data: users1 } = useAsyncData('users', () => $fetch('/api/users'), { imm
|
|
|
142
142
|
const { data: users2 } = useAsyncData('users', () => $fetch('/api/users'), { immediate: false })
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
+
::tip
|
|
146
|
+
Keyed state created using `useAsyncData` can be retrieved across your Nuxt application using [`useNuxtData`](/docs/api/composables/use-nuxt-data).
|
|
147
|
+
::
|
|
148
|
+
|
|
145
149
|
## Return Values
|
|
146
150
|
|
|
147
151
|
- `data`: the result of the asynchronous function that is passed in.
|
|
@@ -82,6 +82,10 @@ const { data: post } = await useFetch(() => `/api/posts/${id.value}`)
|
|
|
82
82
|
|
|
83
83
|
When using `useFetch` with the same URL and options in multiple components, they will share the same `data`, `error` and `status` refs. This ensures consistency across components.
|
|
84
84
|
|
|
85
|
+
::tip
|
|
86
|
+
Keyed state created using `useFetch` can be retrieved across your Nuxt application using [`useNuxtData`](/docs/api/composables/use-nuxt-data).
|
|
87
|
+
::
|
|
88
|
+
|
|
85
89
|
::warning
|
|
86
90
|
`useFetch` is a reserved function name transformed by the compiler, so you should not name your own function `useFetch`.
|
|
87
91
|
::
|