@nuxt/docs-nightly 4.1.3-29300098.2f71703a → 4.1.3-29303775.dc69e26c

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.
Files changed (146) hide show
  1. package/1.getting-started/01.introduction.md +2 -2
  2. package/1.getting-started/03.configuration.md +10 -10
  3. package/1.getting-started/04.views.md +6 -6
  4. package/1.getting-started/05.assets.md +7 -7
  5. package/1.getting-started/06.styling.md +5 -5
  6. package/1.getting-started/07.routing.md +8 -8
  7. package/1.getting-started/08.seo-meta.md +10 -10
  8. package/1.getting-started/09.transitions.md +11 -11
  9. package/1.getting-started/10.data-fetching.md +36 -36
  10. package/1.getting-started/11.state-management.md +7 -7
  11. package/1.getting-started/12.error-handling.md +9 -9
  12. package/1.getting-started/14.layers.md +3 -3
  13. package/1.getting-started/15.prerendering.md +4 -4
  14. package/1.getting-started/16.deployment.md +2 -2
  15. package/1.getting-started/17.testing.md +3 -3
  16. package/1.getting-started/18.upgrade.md +3 -3
  17. package/2.guide/1.concepts/1.auto-imports.md +8 -8
  18. package/2.guide/1.concepts/10.nuxt-lifecycle.md +10 -10
  19. package/2.guide/1.concepts/2.vuejs-development.md +4 -4
  20. package/2.guide/1.concepts/3.rendering.md +9 -9
  21. package/2.guide/1.concepts/4.server-engine.md +5 -5
  22. package/2.guide/1.concepts/5.modules.md +2 -2
  23. package/2.guide/1.concepts/7.esm.md +3 -3
  24. package/2.guide/1.concepts/8.typescript.md +8 -8
  25. package/2.guide/2.directory-structure/0.nuxt.md +2 -2
  26. package/2.guide/2.directory-structure/0.output.md +2 -2
  27. package/2.guide/2.directory-structure/1.app/1.assets.md +2 -2
  28. package/2.guide/2.directory-structure/1.app/1.components.md +5 -5
  29. package/2.guide/2.directory-structure/1.app/1.composables.md +3 -3
  30. package/2.guide/2.directory-structure/1.app/1.layouts.md +6 -6
  31. package/2.guide/2.directory-structure/1.app/1.middleware.md +7 -7
  32. package/2.guide/2.directory-structure/1.app/1.pages.md +14 -14
  33. package/2.guide/2.directory-structure/1.app/1.plugins.md +7 -7
  34. package/2.guide/2.directory-structure/1.app/1.utils.md +3 -3
  35. package/2.guide/2.directory-structure/1.app/3.app-config.md +5 -5
  36. package/2.guide/2.directory-structure/1.app/3.app.md +3 -3
  37. package/2.guide/2.directory-structure/1.app/3.error.md +1 -1
  38. package/2.guide/2.directory-structure/1.content.md +2 -2
  39. package/2.guide/2.directory-structure/1.modules.md +2 -2
  40. package/2.guide/2.directory-structure/1.node_modules.md +1 -1
  41. package/2.guide/2.directory-structure/1.server.md +5 -5
  42. package/2.guide/2.directory-structure/1.shared.md +2 -2
  43. package/2.guide/2.directory-structure/2.env.md +4 -4
  44. package/2.guide/2.directory-structure/2.nuxtignore.md +3 -3
  45. package/2.guide/2.directory-structure/2.nuxtrc.md +2 -2
  46. package/2.guide/2.directory-structure/3.nuxt-config.md +1 -1
  47. package/2.guide/2.directory-structure/3.tsconfig.md +2 -2
  48. package/2.guide/3.going-further/1.experimental-features.md +9 -9
  49. package/2.guide/3.going-further/1.internals.md +10 -10
  50. package/2.guide/3.going-further/10.runtime-config.md +4 -4
  51. package/2.guide/3.going-further/2.hooks.md +3 -3
  52. package/2.guide/3.going-further/3.modules.md +16 -16
  53. package/2.guide/3.going-further/4.kit.md +2 -2
  54. package/2.guide/3.going-further/6.nuxt-app.md +4 -4
  55. package/2.guide/3.going-further/7.layers.md +11 -11
  56. package/2.guide/4.recipes/1.custom-routing.md +11 -11
  57. package/2.guide/4.recipes/2.vite-plugin.md +1 -1
  58. package/2.guide/4.recipes/3.custom-usefetch.md +3 -3
  59. package/2.guide/4.recipes/4.sessions-and-authentication.md +1 -1
  60. package/2.guide/5.best-practices/hydration.md +4 -4
  61. package/2.guide/5.best-practices/performance.md +4 -4
  62. package/3.api/1.components/10.nuxt-picture.md +1 -1
  63. package/3.api/1.components/12.nuxt-route-announcer.md +2 -2
  64. package/3.api/1.components/2.nuxt-page.md +2 -2
  65. package/3.api/1.components/3.nuxt-layout.md +2 -2
  66. package/3.api/1.components/4.nuxt-link.md +3 -3
  67. package/3.api/1.components/5.nuxt-loading-indicator.md +2 -2
  68. package/3.api/2.composables/use-async-data.md +6 -6
  69. package/3.api/2.composables/use-cookie.md +2 -2
  70. package/3.api/2.composables/use-fetch.md +4 -4
  71. package/3.api/2.composables/use-head-safe.md +2 -2
  72. package/3.api/2.composables/use-head.md +2 -2
  73. package/3.api/2.composables/use-hydration.md +1 -1
  74. package/3.api/2.composables/use-lazy-async-data.md +2 -2
  75. package/3.api/2.composables/use-lazy-fetch.md +2 -2
  76. package/3.api/2.composables/use-loading-indicator.md +2 -2
  77. package/3.api/2.composables/use-nuxt-app.md +12 -12
  78. package/3.api/2.composables/use-nuxt-data.md +1 -1
  79. package/3.api/2.composables/use-preview-mode.md +3 -3
  80. package/3.api/2.composables/use-request-event.md +1 -1
  81. package/3.api/2.composables/use-request-fetch.md +2 -2
  82. package/3.api/2.composables/use-request-header.md +1 -1
  83. package/3.api/2.composables/use-request-headers.md +1 -1
  84. package/3.api/2.composables/use-request-url.md +1 -1
  85. package/3.api/2.composables/use-response-header.md +2 -2
  86. package/3.api/2.composables/use-route-announcer.md +1 -1
  87. package/3.api/2.composables/use-route.md +1 -1
  88. package/3.api/2.composables/use-router.md +4 -4
  89. package/3.api/2.composables/use-runtime-hook.md +1 -1
  90. package/3.api/2.composables/use-seo-meta.md +1 -1
  91. package/3.api/2.composables/use-server-seo-meta.md +3 -3
  92. package/3.api/2.composables/use-state.md +1 -1
  93. package/3.api/3.utils/$fetch.md +4 -4
  94. package/3.api/3.utils/abort-navigation.md +1 -1
  95. package/3.api/3.utils/add-route-middleware.md +2 -2
  96. package/3.api/3.utils/call-once.md +1 -1
  97. package/3.api/3.utils/clear-error.md +1 -1
  98. package/3.api/3.utils/clear-nuxt-data.md +1 -1
  99. package/3.api/3.utils/clear-nuxt-state.md +1 -1
  100. package/3.api/3.utils/define-nuxt-plugin.md +3 -3
  101. package/3.api/3.utils/define-nuxt-route-middleware.md +3 -3
  102. package/3.api/3.utils/define-page-meta.md +8 -8
  103. package/3.api/3.utils/define-route-rules.md +2 -2
  104. package/3.api/3.utils/navigate-to.md +1 -1
  105. package/3.api/3.utils/prefetch-components.md +1 -1
  106. package/3.api/3.utils/prerender-routes.md +1 -1
  107. package/3.api/3.utils/refresh-nuxt-data.md +2 -2
  108. package/3.api/3.utils/set-page-layout.md +1 -1
  109. package/3.api/3.utils/set-response-status.md +1 -1
  110. package/3.api/3.utils/show-error.md +2 -2
  111. package/3.api/3.utils/update-app-config.md +1 -1
  112. package/3.api/4.commands/module.md +2 -2
  113. package/3.api/4.commands/prepare.md +1 -1
  114. package/3.api/4.commands/preview.md +2 -2
  115. package/3.api/4.commands/typecheck.md +1 -1
  116. package/3.api/5.kit/10.runtime-config.md +1 -1
  117. package/3.api/5.kit/3.compatibility.md +2 -2
  118. package/3.api/5.kit/4.autoimports.md +1 -1
  119. package/3.api/5.kit/5.components.md +2 -2
  120. package/3.api/5.kit/7.pages.md +3 -3
  121. package/3.api/5.kit/8.layout.md +1 -1
  122. package/3.api/6.advanced/1.hooks.md +2 -2
  123. package/3.api/6.nuxt-config.md +4 -4
  124. package/5.community/2.getting-help.md +1 -1
  125. package/5.community/3.reporting-bugs.md +1 -1
  126. package/5.community/4.contribution.md +10 -10
  127. package/5.community/5.framework-contribution.md +4 -4
  128. package/5.community/6.roadmap.md +1 -1
  129. package/6.bridge/1.overview.md +12 -12
  130. package/6.bridge/2.typescript.md +1 -1
  131. package/6.bridge/3.bridge-composition-api.md +5 -5
  132. package/6.bridge/4.plugins-and-middleware.md +4 -4
  133. package/6.bridge/5.nuxt3-compatible-api.md +9 -9
  134. package/6.bridge/6.meta.md +5 -5
  135. package/6.bridge/7.runtime-config.md +1 -1
  136. package/6.bridge/8.nitro.md +1 -1
  137. package/6.bridge/9.vite.md +1 -1
  138. package/7.migration/1.overview.md +2 -2
  139. package/7.migration/2.configuration.md +5 -5
  140. package/7.migration/20.module-authors.md +6 -6
  141. package/7.migration/3.auto-imports.md +3 -3
  142. package/7.migration/4.meta.md +3 -3
  143. package/7.migration/6.pages-and-layouts.md +8 -8
  144. package/7.migration/7.component-options.md +11 -11
  145. package/7.migration/8.runtime-config.md +3 -3
  146. package/package.json +1 -1
@@ -11,7 +11,7 @@ links:
11
11
  Within your pages, components, and plugins you can use useAsyncData to get access to data that resolves asynchronously.
12
12
 
13
13
  ::note
14
- [`useAsyncData`](/docs/api/composables/use-async-data) is a composable meant to be called directly in the [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context). It returns reactive composables and handles adding responses to the Nuxt payload so they can be passed from server to client **without re-fetching the data on client side** when the page hydrates.
14
+ [`useAsyncData`](/docs/4.x/api/composables/use-async-data) is a composable meant to be called directly in the [Nuxt context](/docs/4.x/guide/going-further/nuxt-app#the-nuxt-context). It returns reactive composables and handles adding responses to the Nuxt payload so they can be passed from server to client **without re-fetching the data on client side** when the page hydrates.
15
15
  ::
16
16
 
17
17
  ## Usage
@@ -26,7 +26,7 @@ const { data, status, error, refresh, clear } = await useAsyncData(
26
26
  ```
27
27
 
28
28
  ::warning
29
- If you're using a custom useAsyncData wrapper, do not await it in the composable, as that can cause unexpected behavior. Please follow [this recipe](/docs/guide/recipes/custom-usefetch#custom-usefetch) for more information on how to make a custom async data fetcher.
29
+ If you're using a custom useAsyncData wrapper, do not await it in the composable, as that can cause unexpected behavior. Please follow [this recipe](/docs/4.x/guide/recipes/custom-usefetch#custom-usefetchuseasyncdata) for more information on how to make a custom async data fetcher.
30
30
  ::
31
31
 
32
32
  ::note
@@ -71,7 +71,7 @@ const { data: user } = useAsyncData(
71
71
  ```
72
72
 
73
73
  ::warning
74
- [`useAsyncData`](/docs/api/composables/use-async-data) is a reserved function name transformed by the compiler, so you should not name your own function [`useAsyncData`](/docs/api/composables/use-async-data).
74
+ [`useAsyncData`](/docs/4.x/api/composables/use-async-data) is a reserved function name transformed by the compiler, so you should not name your own function [`useAsyncData`](/docs/4.x/api/composables/use-async-data).
75
75
  ::
76
76
 
77
77
  :read-more{to="/docs/getting-started/data-fetching#useasyncdata"}
@@ -81,7 +81,7 @@ const { data: user } = useAsyncData(
81
81
  - `key`: a unique key to ensure that data fetching can be properly de-duplicated across requests. If you do not provide a key, then a key that is unique to the file name and line number of the instance of `useAsyncData` will be generated for you.
82
82
  - `handler`: an asynchronous function that must return a truthy value (for example, it should not be `undefined` or `null`) or the request may be duplicated on the client side.
83
83
  ::warning
84
- The `handler` function should be **side-effect free** to ensure predictable behavior during SSR and CSR hydration. If you need to trigger side effects, use the [`callOnce`](/docs/api/utils/call-once) utility to do so.
84
+ The `handler` function should be **side-effect free** to ensure predictable behavior during SSR and CSR hydration. If you need to trigger side effects, use the [`callOnce`](/docs/4.x/api/utils/call-once) utility to do so.
85
85
  ::
86
86
  - `options`:
87
87
  - `server`: whether to fetch the data on the server (defaults to `true`)
@@ -143,7 +143,7 @@ const { data: users2 } = useAsyncData('users', () => $fetch('/api/users'), { imm
143
143
  ```
144
144
 
145
145
  ::tip
146
- Keyed state created using `useAsyncData` can be retrieved across your Nuxt application using [`useNuxtData`](/docs/api/composables/use-nuxt-data).
146
+ Keyed state created using `useAsyncData` can be retrieved across your Nuxt application using [`useNuxtData`](/docs/4.x/api/composables/use-nuxt-data).
147
147
  ::
148
148
 
149
149
  ## Return Values
@@ -163,7 +163,7 @@ Keyed state created using `useAsyncData` can be retrieved across your Nuxt appli
163
163
  By default, Nuxt waits until a `refresh` is finished before it can be executed again.
164
164
 
165
165
  ::note
166
- If you have not fetched data on the server (for example, with `server: false`), then the data _will not_ be fetched until hydration completes. This means even if you await [`useAsyncData`](/docs/api/composables/use-async-data) on the client side, `data` will remain `undefined` within `<script setup>`.
166
+ If you have not fetched data on the server (for example, with `server: false`), then the data _will not_ be fetched until hydration completes. This means even if you await [`useAsyncData`](/docs/4.x/api/composables/use-async-data) on the client side, `data` will remain `undefined` within `<script setup>`.
167
167
  ::
168
168
 
169
169
  ## Type
@@ -17,7 +17,7 @@ const cookie = useCookie(name, options)
17
17
  ```
18
18
 
19
19
  ::note
20
- `useCookie` only works in the [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context).
20
+ `useCookie` only works in the [Nuxt context](/docs/4.x/guide/going-further/nuxt-app#the-nuxt-context).
21
21
  ::
22
22
 
23
23
  ::tip
@@ -59,7 +59,7 @@ Most of the options will be directly passed to the [cookie](https://github.com/j
59
59
  | `decode` | `(value: string) => T` | `decodeURIComponent` + [destr](https://github.com/unjs/destr). | Custom function to decode the cookie value. Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode a previously encoded cookie value into a JavaScript string or other object. <br/> **Note:** If an error is thrown from this function, the original, non-decoded cookie value will be returned as the cookie's value. |
60
60
  | `encode` | `(value: T) => string` | `JSON.stringify` + `encodeURIComponent` | Custom function to encode the cookie value. Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to encode a value into a string suited for a cookie's value. |
61
61
  | `default` | `() => T \| Ref<T>` | `undefined` | Function returning the default value if the cookie does not exist. The function can also return a `Ref`. |
62
- | `watch` | `boolean \| 'shallow'` | `true` | Whether to watch for changes and update the cookie. `true` for deep watch, `'shallow'` for shallow watch, i.e. data changes for only top level properties, `false` to disable. <br/> **Note:** Refresh `useCookie` values manually when a cookie has changed with [`refreshCookie`](/docs/api/utils/refresh-cookie). |
62
+ | `watch` | `boolean \| 'shallow'` | `true` | Whether to watch for changes and update the cookie. `true` for deep watch, `'shallow'` for shallow watch, i.e. data changes for only top level properties, `false` to disable. <br/> **Note:** Refresh `useCookie` values manually when a cookie has changed with [`refreshCookie`](/docs/4.x/api/utils/refresh-cookie). |
63
63
  | `readonly` | `boolean` | `false` | If `true`, disables writing to the cookie. |
64
64
  | `maxAge` | `number` | `undefined` | Max age in seconds for the cookie, i.e. the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2). The given number will be converted to an integer by rounding down. By default, no maximum age is set. |
65
65
  | `expires` | `Date` | `undefined` | Expiration date for the cookie. By default, no expiration is set. Most clients will consider this a "non-persistent cookie" and will delete it on a condition like exiting a web browser application. <br/> **Note:** The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and `maxAge` is set, then `maxAge` takes precedence, but not all clients may obey this, so if both are set, they should point to the same date and time! <br/>If neither of `expires` and `maxAge` is set, the cookie will be session-only and removed when the user closes their browser. |
@@ -8,7 +8,7 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- This composable provides a convenient wrapper around [`useAsyncData`](/docs/api/composables/use-async-data) and [`$fetch`](/docs/api/utils/dollarfetch).
11
+ This composable provides a convenient wrapper around [`useAsyncData`](/docs/4.x/api/composables/use-async-data) and [`$fetch`](/docs/4.x/api/utils/dollarfetch).
12
12
  It automatically generates a key based on URL and fetch options, provides type hints for request url based on server routes, and infers API response type.
13
13
 
14
14
  ::note
@@ -26,7 +26,7 @@ const { data, status, error, refresh, clear } = await useFetch('/api/modules', {
26
26
  ```
27
27
 
28
28
  ::warning
29
- If you're using a custom useFetch wrapper, do not await it in the composable, as that can cause unexpected behavior. Please follow [this recipe](/docs/guide/recipes/custom-usefetch#custom-usefetch) for more information on how to make a custom async data fetcher.
29
+ If you're using a custom useFetch wrapper, do not await it in the composable, as that can cause unexpected behavior. Please follow [this recipe](/docs/4.x/guide/recipes/custom-usefetch#custom-usefetchuseasyncdata) for more information on how to make a custom async data fetcher.
30
30
  ::
31
31
 
32
32
  ::note
@@ -83,7 +83,7 @@ const { data: post } = await useFetch(() => `/api/posts/${id.value}`)
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
85
  ::tip
86
- Keyed state created using `useFetch` can be retrieved across your Nuxt application using [`useNuxtData`](/docs/api/composables/use-nuxt-data).
86
+ Keyed state created using `useFetch` can be retrieved across your Nuxt application using [`useNuxtData`](/docs/4.x/api/composables/use-nuxt-data).
87
87
  ::
88
88
 
89
89
  ::warning
@@ -152,7 +152,7 @@ type AsyncDataRequestStatus = 'idle' | 'pending' | 'success' | 'error'
152
152
 
153
153
  - `URL` (`string | Request | Ref<string | Request> | () => string | Request`): The URL or request to fetch. Can be a string, a Request object, a Vue ref, or a function returning a string/Request. Supports reactivity for dynamic endpoints.
154
154
 
155
- - `options` (object): Configuration for the fetch request. Extends [unjs/ofetch](https://github.com/unjs/ofetch) options and [`AsyncDataOptions`](/docs/api/composables/use-async-data#params). All options can be a static value, a `ref`, or a computed value.
155
+ - `options` (object): Configuration for the fetch request. Extends [unjs/ofetch](https://github.com/unjs/ofetch) options and [`AsyncDataOptions`](/docs/4.x/api/composables/use-async-data#params). All options can be a static value, a `ref`, or a computed value.
156
156
 
157
157
  | Option | Type | Default | Description |
158
158
  | ---| --- | --- | --- |
@@ -8,11 +8,11 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- The `useHeadSafe` composable is a wrapper around the [`useHead`](/docs/api/composables/use-head) composable that restricts the input to only allow safe values.
11
+ The `useHeadSafe` composable is a wrapper around the [`useHead`](/docs/4.x/api/composables/use-head) composable that restricts the input to only allow safe values.
12
12
 
13
13
  ## Usage
14
14
 
15
- You can pass all the same values as [`useHead`](/docs/api/composables/use-head)
15
+ You can pass all the same values as [`useHead`](/docs/4.x/api/composables/use-head)
16
16
 
17
17
  ```ts
18
18
  useHeadSafe({
@@ -8,7 +8,7 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- The [`useHead`](/docs/api/composables/use-head) composable function allows you to manage your head tags in a programmatic and reactive way, powered by [Unhead](https://unhead.unjs.io). If the data comes from a user or other untrusted source, we recommend you check out [`useHeadSafe`](/docs/api/composables/use-head-safe).
11
+ The [`useHead`](/docs/4.x/api/composables/use-head) composable function allows you to manage your head tags in a programmatic and reactive way, powered by [Unhead](https://unhead.unjs.io). If the data comes from a user or other untrusted source, we recommend you check out [`useHeadSafe`](/docs/4.x/api/composables/use-head-safe).
12
12
 
13
13
  :read-more{to="/docs/getting-started/seo-meta"}
14
14
 
@@ -18,7 +18,7 @@ The [`useHead`](/docs/api/composables/use-head) composable function allows you t
18
18
  useHead(meta: MaybeComputedRef<MetaObject>): void
19
19
  ```
20
20
 
21
- Below are the non-reactive types for [`useHead`](/docs/api/composables/use-head) .
21
+ Below are the non-reactive types for [`useHead`](/docs/4.x/api/composables/use-head) .
22
22
 
23
23
  ```ts
24
24
  interface MetaObject {
@@ -13,7 +13,7 @@ This is an advanced composable, primarily designed for use within plugins, mostl
13
13
  ::
14
14
 
15
15
  ::note
16
- `useHydration` is designed to **ensure state synchronization and restoration during SSR**. If you need to create a globally reactive state that is SSR-friendly in Nuxt, [`useState`](/docs/api/composables/use-state) is the recommended choice.
16
+ `useHydration` is designed to **ensure state synchronization and restoration during SSR**. If you need to create a globally reactive state that is SSR-friendly in Nuxt, [`useState`](/docs/4.x/api/composables/use-state) is the recommended choice.
17
17
  ::
18
18
 
19
19
  `useHydration` is a built-in composable that provides a way to set data on the server side every time a new HTTP request is made and receive that data on the client side. This way `useHydration` allows you to take full control of the hydration cycle.
@@ -10,10 +10,10 @@ links:
10
10
 
11
11
  ## Description
12
12
 
13
- By default, [`useAsyncData`](/docs/api/composables/use-async-data) blocks navigation until its async handler is resolved. `useLazyAsyncData` provides a wrapper around [`useAsyncData`](/docs/api/composables/use-async-data) that triggers navigation before the handler is resolved by setting the `lazy` option to `true`.
13
+ By default, [`useAsyncData`](/docs/4.x/api/composables/use-async-data) blocks navigation until its async handler is resolved. `useLazyAsyncData` provides a wrapper around [`useAsyncData`](/docs/4.x/api/composables/use-async-data) that triggers navigation before the handler is resolved by setting the `lazy` option to `true`.
14
14
 
15
15
  ::note
16
- `useLazyAsyncData` has the same signature as [`useAsyncData`](/docs/api/composables/use-async-data).
16
+ `useLazyAsyncData` has the same signature as [`useAsyncData`](/docs/4.x/api/composables/use-async-data).
17
17
  ::
18
18
 
19
19
  :read-more{to="/docs/api/composables/use-async-data"}
@@ -10,10 +10,10 @@ links:
10
10
 
11
11
  ## Description
12
12
 
13
- By default, [`useFetch`](/docs/api/composables/use-fetch) blocks navigation until its async handler is resolved. `useLazyFetch` provides a wrapper around [`useFetch`](/docs/api/composables/use-fetch) that triggers navigation before the handler is resolved by setting the `lazy` option to `true`.
13
+ By default, [`useFetch`](/docs/4.x/api/composables/use-fetch) blocks navigation until its async handler is resolved. `useLazyFetch` provides a wrapper around [`useFetch`](/docs/4.x/api/composables/use-fetch) that triggers navigation before the handler is resolved by setting the `lazy` option to `true`.
14
14
 
15
15
  ::note
16
- `useLazyFetch` has the same signature as [`useFetch`](/docs/api/composables/use-fetch).
16
+ `useLazyFetch` has the same signature as [`useFetch`](/docs/4.x/api/composables/use-fetch).
17
17
  ::
18
18
 
19
19
  ::note
@@ -10,8 +10,8 @@ links:
10
10
 
11
11
  ## Description
12
12
 
13
- A composable which returns the loading state of the page. Used by [`<NuxtLoadingIndicator>`](/docs/api/components/nuxt-loading-indicator) and controllable.
14
- It hooks into [`page:loading:start`](/docs/api/advanced/hooks#app-hooks-runtime) and [`page:loading:end`](/docs/api/advanced/hooks#app-hooks-runtime) to change its state.
13
+ A composable which returns the loading state of the page. Used by [`<NuxtLoadingIndicator>`](/docs/4.x/api/components/nuxt-loading-indicator) and controllable.
14
+ It hooks into [`page:loading:start`](/docs/4.x/api/advanced/hooks#app-hooks-runtime) and [`page:loading:end`](/docs/4.x/api/advanced/hooks#app-hooks-runtime) to change its state.
15
15
 
16
16
  ## Parameters
17
17
 
@@ -8,7 +8,7 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- `useNuxtApp` is a built-in composable that provides a way to access shared runtime context of Nuxt, also known as the [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context), which is available on both client and server side (but not within Nitro routes). It helps you access the Vue app instance, runtime hooks, runtime config variables and internal states, such as `ssrContext` and `payload`.
11
+ `useNuxtApp` is a built-in composable that provides a way to access shared runtime context of Nuxt, also known as the [Nuxt context](/docs/4.x/guide/going-further/nuxt-app#the-nuxt-context), which is available on both client and server side (but not within Nitro routes). It helps you access the Vue app instance, runtime hooks, runtime config variables and internal states, such as `ssrContext` and `payload`.
12
12
 
13
13
  ```vue [app/app.vue]
14
14
  <script setup lang="ts">
@@ -16,11 +16,11 @@ const nuxtApp = useNuxtApp()
16
16
  </script>
17
17
  ```
18
18
 
19
- If runtime context is unavailable in your scope, `useNuxtApp` will throw an exception when called. You can use [`tryUseNuxtApp`](#tryusenuxtapp) instead for composables that do not require `nuxtApp`, or to simply check if context is available or not without an exception.
19
+ If runtime context is unavailable in your scope, `useNuxtApp` will throw an exception when called. You can use [`tryUseNuxtApp`](/docs/4.x/api/composables/use-nuxt-app#tryusenuxtapp) instead for composables that do not require `nuxtApp`, or to simply check if context is available or not without an exception.
20
20
 
21
21
  <!--
22
22
  note
23
- By default, the shared runtime context of Nuxt is namespaced under the [`buildId`](/docs/api/nuxt-config#buildid) option. It allows the support of multiple runtime contexts.
23
+ By default, the shared runtime context of Nuxt is namespaced under the [`buildId`](/docs/4.x/api/nuxt-config#buildid) option. It allows the support of multiple runtime contexts.
24
24
 
25
25
  ## Params
26
26
 
@@ -30,7 +30,7 @@ By default, the shared runtime context of Nuxt is namespaced under the [`buildId
30
30
 
31
31
  ### `provide (name, value)`
32
32
 
33
- `nuxtApp` is a runtime context that you can extend using [Nuxt plugins](/docs/guide/directory-structure/plugins). Use the `provide` function to create Nuxt plugins to make values and helper methods available in your Nuxt application across all composables and components.
33
+ `nuxtApp` is a runtime context that you can extend using [Nuxt plugins](/docs/4.x/guide/directory-structure/plugins). Use the `provide` function to create Nuxt plugins to make values and helper methods available in your Nuxt application across all composables and components.
34
34
 
35
35
  `provide` function accepts `name` and `value` parameters.
36
36
 
@@ -46,11 +46,11 @@ As you can see in the example above, `$hello` has become the new and custom part
46
46
 
47
47
  ### `hook(name, cb)`
48
48
 
49
- Hooks available in `nuxtApp` allows you to customize the runtime aspects of your Nuxt application. You can use runtime hooks in Vue.js composables and [Nuxt plugins](/docs/guide/directory-structure/plugins) to hook into the rendering lifecycle.
49
+ Hooks available in `nuxtApp` allows you to customize the runtime aspects of your Nuxt application. You can use runtime hooks in Vue.js composables and [Nuxt plugins](/docs/4.x/guide/directory-structure/plugins) to hook into the rendering lifecycle.
50
50
 
51
51
  `hook` function is useful for adding custom logic by hooking into the rendering lifecycle at a specific point. `hook` function is mostly used when creating Nuxt plugins.
52
52
 
53
- See [Runtime Hooks](/docs/api/advanced/hooks#app-hooks-runtime) for available runtime hooks called by Nuxt.
53
+ See [Runtime Hooks](/docs/4.x/api/advanced/hooks#app-hooks-runtime) for available runtime hooks called by Nuxt.
54
54
 
55
55
  ```ts [app/plugins/test.ts]
56
56
  export default defineNuxtPlugin((nuxtApp) => {
@@ -84,8 +84,8 @@ await nuxtApp.callHook('my-plugin:init')
84
84
 
85
85
  Some useful methods:
86
86
  - [`component()`](https://vuejs.org/api/application.html#app-component) - Registers a global component if passing both a name string and a component definition, or retrieves an already registered one if only the name is passed.
87
- - [`directive()`](https://vuejs.org/api/application.html#app-directive) - Registers a global custom directive if passing both a name string and a directive definition, or retrieves an already registered one if only the name is passed[(example)](/docs/guide/directory-structure/plugins#vue-directives).
88
- - [`use()`](https://vuejs.org/api/application.html#app-use) - Installs a **[Vue.js Plugin](https://vuejs.org/guide/reusability/plugins.html)** [(example)](/docs/guide/directory-structure/plugins#vue-plugins).
87
+ - [`directive()`](https://vuejs.org/api/application.html#app-directive) - Registers a global custom directive if passing both a name string and a directive definition, or retrieves an already registered one if only the name is passed[(example)](/docs/4.x/guide/directory-structure/plugins#vue-directives).
88
+ - [`use()`](https://vuejs.org/api/application.html#app-use) - Installs a **[Vue.js Plugin](https://vuejs.org/guide/reusability/plugins.html)** [(example)](/docs/4.x/guide/directory-structure/plugins#vue-plugins).
89
89
 
90
90
  :read-more{icon="i-simple-icons-vuedotjs" to="https://vuejs.org/api/application.html#application-api"}
91
91
 
@@ -103,7 +103,7 @@ Nuxt exposes the following properties through `ssrContext`:
103
103
  `payload` exposes data and state variables from server side to client side. The following keys will be available on the client after they have been passed from the server side:
104
104
 
105
105
  - `serverRendered` (boolean) - Indicates if response is server-side-rendered.
106
- - `data` (object) - When you fetch the data from an API endpoint using either [`useFetch`](/docs/api/composables/use-fetch) or [`useAsyncData`](/docs/api/composables/use-async-data) , resulting payload can be accessed from the `payload.data`. This data is cached and helps you prevent fetching the same data in case an identical request is made more than once.
106
+ - `data` (object) - When you fetch the data from an API endpoint using either [`useFetch`](/docs/4.x/api/composables/use-fetch) or [`useAsyncData`](/docs/4.x/api/composables/use-async-data) , resulting payload can be accessed from the `payload.data`. This data is cached and helps you prevent fetching the same data in case an identical request is made more than once.
107
107
 
108
108
  ::code-group
109
109
  ```vue [app/app.vue]
@@ -118,11 +118,11 @@ Nuxt exposes the following properties through `ssrContext`:
118
118
  ```
119
119
  ::
120
120
 
121
- After fetching the value of `count` using [`useAsyncData`](/docs/api/composables/use-async-data) in the example above, if you access `payload.data`, you will see `{ count: 1 }` recorded there.
121
+ After fetching the value of `count` using [`useAsyncData`](/docs/4.x/api/composables/use-async-data) in the example above, if you access `payload.data`, you will see `{ count: 1 }` recorded there.
122
122
 
123
- When accessing the same `payload.data` from [`ssrcontext`](#ssrcontext), you can access the same value on the server side as well.
123
+ When accessing the same `payload.data` from [`ssrcontext`](/docs/4.x/api/composables/use-nuxt-app#ssrcontext), you can access the same value on the server side as well.
124
124
 
125
- - `state` (object) - When you use [`useState`](/docs/api/composables/use-state) composable in Nuxt to set shared state, this state data is accessed through `payload.state.[name-of-your-state]`.
125
+ - `state` (object) - When you use [`useState`](/docs/4.x/api/composables/use-state) composable in Nuxt to set shared state, this state data is accessed through `payload.state.[name-of-your-state]`.
126
126
 
127
127
  ```ts [app/plugins/my-plugin.ts]
128
128
  export const useColor = () => useState<string>('color', () => 'pink')
@@ -9,7 +9,7 @@ links:
9
9
  ---
10
10
 
11
11
  ::note
12
- `useNuxtData` gives you access to the current cached value of [`useAsyncData`](/docs/api/composables/use-async-data) , [`useLazyAsyncData`](/docs/api/composables/use-lazy-async-data), [`useFetch`](/docs/api/composables/use-fetch) and [`useLazyFetch`](/docs/api/composables/use-lazy-fetch) with explicitly provided key.
12
+ `useNuxtData` gives you access to the current cached value of [`useAsyncData`](/docs/4.x/api/composables/use-async-data) , [`useLazyAsyncData`](/docs/4.x/api/composables/use-lazy-async-data), [`useFetch`](/docs/4.x/api/composables/use-fetch) and [`useLazyFetch`](/docs/4.x/api/composables/use-lazy-fetch) with explicitly provided key.
13
13
  ::
14
14
 
15
15
  ## Usage
@@ -12,7 +12,7 @@ links:
12
12
 
13
13
  Preview mode allows you to see how your changes would be displayed on a live site without revealing them to users.
14
14
 
15
- You can use the built-in `usePreviewMode` composable to access and control preview state in Nuxt. If the composable detects preview mode it will automatically force any updates necessary for [`useAsyncData`](/docs/api/composables/use-async-data) and [`useFetch`](/docs/api/composables/use-fetch) to rerender preview content.
15
+ You can use the built-in `usePreviewMode` composable to access and control preview state in Nuxt. If the composable detects preview mode it will automatically force any updates necessary for [`useAsyncData`](/docs/4.x/api/composables/use-async-data) and [`useFetch`](/docs/4.x/api/composables/use-fetch) to rerender preview content.
16
16
 
17
17
  ```js
18
18
  const { enabled, state } = usePreviewMode()
@@ -36,7 +36,7 @@ export function useMyPreviewMode () {
36
36
 
37
37
  ### Modify default state
38
38
 
39
- `usePreviewMode` will try to store the value of a `token` param from url in state. You can modify this state and it will be available for all [`usePreviewMode`](/docs/api/composables/use-preview-mode) calls.
39
+ `usePreviewMode` will try to store the value of a `token` param from url in state. You can modify this state and it will be available for all [`usePreviewMode`](/docs/4.x/api/composables/use-preview-mode) calls.
40
40
 
41
41
  ```js
42
42
  const data1 = ref('data1')
@@ -114,5 +114,5 @@ Then you can see your preview page by adding the query param `preview` to the en
114
114
  ```
115
115
 
116
116
  ::note
117
- `usePreviewMode` should be tested locally with `nuxt generate` and then `nuxt preview` rather than `nuxt dev`. (The [preview command](/docs/api/commands/preview) is not related to preview mode.)
117
+ `usePreviewMode` should be tested locally with `nuxt generate` and then `nuxt preview` rather than `nuxt dev`. (The [preview command](/docs/4.x/api/commands/preview) is not related to preview mode.)
118
118
  ::
@@ -8,7 +8,7 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- Within the [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context) you can use `useRequestEvent` to access the incoming request.
11
+ Within the [Nuxt context](/docs/4.x/guide/going-further/nuxt-app#the-nuxt-context) you can use `useRequestEvent` to access the incoming request.
12
12
 
13
13
  ```ts
14
14
  // Get underlying request event
@@ -19,7 +19,7 @@ Headers that are **not meant to be forwarded** will **not be included** in the r
19
19
  ::
20
20
 
21
21
  ::tip
22
- The [`useFetch`](/docs/api/composables/use-fetch) composable uses `useRequestFetch` under the hood to automatically forward the request context and headers.
22
+ The [`useFetch`](/docs/4.x/api/composables/use-fetch) composable uses `useRequestFetch` under the hood to automatically forward the request context and headers.
23
23
  ::
24
24
 
25
25
  ::code-group
@@ -48,5 +48,5 @@ export default defineEventHandler((event) => {
48
48
  ::
49
49
 
50
50
  ::tip
51
- In the browser during client-side navigation, `useRequestFetch` will behave just like regular [`$fetch`](/docs/api/utils/dollarfetch).
51
+ In the browser during client-side navigation, `useRequestFetch` will behave just like regular [`$fetch`](/docs/4.x/api/utils/dollarfetch).
52
52
  ::
@@ -8,7 +8,7 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- You can use the built-in [`useRequestHeader`](/docs/api/composables/use-request-header) composable to access any incoming request header within your pages, components, and plugins.
11
+ You can use the built-in [`useRequestHeader`](/docs/4.x/api/composables/use-request-header) composable to access any incoming request header within your pages, components, and plugins.
12
12
 
13
13
  ```ts
14
14
  // Get the authorization request header
@@ -8,7 +8,7 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- You can use built-in [`useRequestHeaders`](/docs/api/composables/use-request-headers) composable to access the incoming request headers within your pages, components, and plugins.
11
+ You can use built-in [`useRequestHeaders`](/docs/4.x/api/composables/use-request-headers) composable to access the incoming request headers within your pages, components, and plugins.
12
12
 
13
13
  ```js
14
14
  // Get all request headers
@@ -11,7 +11,7 @@ links:
11
11
  `useRequestURL` is a helper function that returns an [URL object](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) working on both server-side and client-side.
12
12
 
13
13
  ::important
14
- When utilizing [Hybrid Rendering](/docs/guide/concepts/rendering#hybrid-rendering) with cache strategies, all incoming request headers are dropped when handling the cached responses via the [Nitro caching layer](https://nitro.build/guide/cache) (meaning `useRequestURL` will return `localhost` for the `host`).
14
+ When utilizing [Hybrid Rendering](/docs/4.x/guide/concepts/rendering#hybrid-rendering) with cache strategies, all incoming request headers are dropped when handling the cached responses via the [Nitro caching layer](https://nitro.build/guide/cache) (meaning `useRequestURL` will return `localhost` for the `host`).
15
15
 
16
16
  You can define the [`cache.varies` option](https://nitro.build/guide/cache#options) to specify headers that will be considered when caching and serving the responses, such as `host` and `x-forwarded-host` for multi-tenant environments.
17
17
  ::
@@ -12,7 +12,7 @@ links:
12
12
  This composable is available in Nuxt v3.14+.
13
13
  ::
14
14
 
15
- You can use the built-in [`useResponseHeader`](/docs/api/composables/use-response-header) composable to set any server response header within your pages, components, and plugins.
15
+ You can use the built-in [`useResponseHeader`](/docs/4.x/api/composables/use-response-header) composable to set any server response header within your pages, components, and plugins.
16
16
 
17
17
  ```ts
18
18
  // Set a custom response header
@@ -37,7 +37,7 @@ header.value = 'my-value';
37
37
  </template>
38
38
  ```
39
39
 
40
- We can use `useResponseHeader` for example in Nuxt [middleware](/docs/guide/directory-structure/app/middleware) to set a response header for all pages.
40
+ We can use `useResponseHeader` for example in Nuxt [middleware](/docs/4.x/guide/directory-structure/app/middleware) to set a response header for all pages.
41
41
 
42
42
  ```ts [app/middleware/my-header-middleware.ts]
43
43
  export default defineNuxtRouteMiddleware((to, from) => {
@@ -16,7 +16,7 @@ This composable is available in Nuxt v3.12+.
16
16
 
17
17
  ## Description
18
18
 
19
- A composable which observes the page title changes and updates the announcer message accordingly. Used by [`<NuxtRouteAnnouncer>`](/docs/api/components/nuxt-route-announcer) and controllable.
19
+ A composable which observes the page title changes and updates the announcer message accordingly. Used by [`<NuxtRouteAnnouncer>`](/docs/4.x/api/components/nuxt-route-announcer) and controllable.
20
20
  It hooks into Unhead's [`dom:rendered`](https://unhead.unjs.io/docs/typescript/head/api/hooks/dom-rendered) to read the page's title and set it as the announcer message.
21
21
 
22
22
  ## Parameters
@@ -20,7 +20,7 @@ that rely on the route metadata, for example.
20
20
 
21
21
  ## Example
22
22
 
23
- In the following example, we call an API via [`useFetch`](/docs/api/composables/use-fetch) using a dynamic page parameter - `slug` - as part of the URL.
23
+ In the following example, we call an API via [`useFetch`](/docs/4.x/api/composables/use-fetch) using a dynamic page parameter - `slug` - as part of the URL.
24
24
 
25
25
  ```html [~/pages/[slug\\].vue]
26
26
  <script setup lang="ts">
@@ -47,7 +47,7 @@ router.resolve({ name: 'home' })
47
47
  ```
48
48
 
49
49
  ::note
50
- `router.addRoute()` adds route details into an array of routes and it is useful while building [Nuxt plugins](/docs/guide/directory-structure/plugins) while `router.push()` on the other hand, triggers a new navigation immediately and it is useful in pages, Vue components and composable.
50
+ `router.addRoute()` adds route details into an array of routes and it is useful while building [Nuxt plugins](/docs/4.x/guide/directory-structure/plugins) while `router.push()` on the other hand, triggers a new navigation immediately and it is useful in pages, Vue components and composable.
51
51
  ::
52
52
 
53
53
  ## Based on History API
@@ -55,8 +55,8 @@ router.resolve({ name: 'home' })
55
55
  - [`back()`](https://router.vuejs.org/api/interfaces/Router.html#back): Go back in history if possible, same as `router.go(-1)`.
56
56
  - [`forward()`](https://router.vuejs.org/api/interfaces/Router.html#forward): Go forward in history if possible, same as `router.go(1)`.
57
57
  - [`go()`](https://router.vuejs.org/api/interfaces/Router.html#go): Move forward or backward through the history without the hierarchical restrictions enforced in `router.back()` and `router.forward()`.
58
- - [`push()`](https://router.vuejs.org/api/interfaces/Router.html#push): Programmatically navigate to a new URL by pushing an entry in the history stack. **It is recommended to use [`navigateTo`](/docs/api/utils/navigate-to) instead.**
59
- - [`replace()`](https://router.vuejs.org/api/interfaces/Router.html#replace): Programmatically navigate to a new URL by replacing the current entry in the routes history stack. **It is recommended to use [`navigateTo`](/docs/api/utils/navigate-to) instead.**
58
+ - [`push()`](https://router.vuejs.org/api/interfaces/Router.html#push): Programmatically navigate to a new URL by pushing an entry in the history stack. **It is recommended to use [`navigateTo`](/docs/4.x/api/utils/navigate-to) instead.**
59
+ - [`replace()`](https://router.vuejs.org/api/interfaces/Router.html#replace): Programmatically navigate to a new URL by replacing the current entry in the routes history stack. **It is recommended to use [`navigateTo`](/docs/4.x/api/utils/navigate-to) instead.**
60
60
 
61
61
  ```ts [Example]
62
62
  const router = useRouter()
@@ -89,4 +89,4 @@ However, Nuxt has a concept of **route middleware** that simplifies the implemen
89
89
 
90
90
  ## Universal Router Instance
91
91
 
92
- If you do not have a `app/pages/` folder, then [`useRouter`](/docs/api/composables/use-router) will return a universal router instance with similar helper methods, but be aware that not all features may be supported or behave in exactly the same way as with `vue-router`.
92
+ If you do not have a `app/pages/` folder, then [`useRouter`](/docs/4.x/api/composables/use-router) will return a universal router instance with similar helper methods, but be aware that not all features may be supported or behave in exactly the same way as with `vue-router`.
@@ -23,7 +23,7 @@ function useRuntimeHook<THookName extends keyof RuntimeNuxtHooks>(
23
23
 
24
24
  ### Parameters
25
25
 
26
- - `name`: The name of the runtime hook to register. You can see the full list of [runtime Nuxt hooks here](/docs/api/advanced/hooks#app-hooks-runtime).
26
+ - `name`: The name of the runtime hook to register. You can see the full list of [runtime Nuxt hooks here](/docs/4.x/api/advanced/hooks#app-hooks-runtime).
27
27
  - `fn`: The callback function to execute when the hook is triggered. The function signature varies based on the hook name.
28
28
 
29
29
  ### Returns
@@ -77,4 +77,4 @@ useSeoMeta({
77
77
  </script>
78
78
  ```
79
79
 
80
- This previously used the [`useServerSeoMeta`](/docs/api/composables/use-server-seo-meta) composable, but it has been deprecated in favor of this approach.
80
+ This previously used the [`useServerSeoMeta`](/docs/4.x/api/composables/use-server-seo-meta) composable, but it has been deprecated in favor of this approach.
@@ -8,11 +8,11 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- Just like [`useSeoMeta`](/docs/api/composables/use-seo-meta), `useServerSeoMeta` composable lets you define your site's SEO meta tags as a flat object with full TypeScript support.
11
+ Just like [`useSeoMeta`](/docs/4.x/api/composables/use-seo-meta), `useServerSeoMeta` composable lets you define your site's SEO meta tags as a flat object with full TypeScript support.
12
12
 
13
13
  :read-more{to="/docs/api/composables/use-seo-meta"}
14
14
 
15
- In most instances, the meta doesn't need to be reactive as robots will only scan the initial load. So we recommend using [`useServerSeoMeta`](/docs/api/composables/use-server-seo-meta) as a performance-focused utility that will not do anything (or return a `head` object) on the client.
15
+ In most instances, the meta doesn't need to be reactive as robots will only scan the initial load. So we recommend using [`useServerSeoMeta`](/docs/4.x/api/composables/use-server-seo-meta) as a performance-focused utility that will not do anything (or return a `head` object) on the client.
16
16
 
17
17
  ```vue [app/app.vue]
18
18
  <script setup lang="ts">
@@ -22,6 +22,6 @@ useServerSeoMeta({
22
22
  </script>
23
23
  ```
24
24
 
25
- Parameters are exactly the same as with [`useSeoMeta`](/docs/api/composables/use-seo-meta)
25
+ Parameters are exactly the same as with [`useSeoMeta`](/docs/4.x/api/composables/use-seo-meta)
26
26
 
27
27
  :read-more{to="/docs/getting-started/seo-meta"}
@@ -43,6 +43,6 @@ useState<T>(init?: () => T | Ref<T>): Ref<T>
43
43
  useState<T>(key: string, init?: () => T | Ref<T>): Ref<T>
44
44
  ```
45
45
 
46
- - `key`: A unique key ensuring that data fetching is properly de-duplicated across requests. If you do not provide a key, then a key that is unique to the file and line number of the instance of [`useState`](/docs/api/composables/use-state) will be generated for you.
46
+ - `key`: A unique key ensuring that data fetching is properly de-duplicated across requests. If you do not provide a key, then a key that is unique to the file and line number of the instance of [`useState`](/docs/4.x/api/composables/use-state) will be generated for you.
47
47
  - `init`: A function that provides initial value for the state when not initiated. This function can also return a `Ref`.
48
48
  - `T`: (typescript only) Specify the type of state
@@ -11,16 +11,16 @@ links:
11
11
  Nuxt uses [ofetch](https://github.com/unjs/ofetch) to expose globally the `$fetch` helper for making HTTP requests within your Vue app or API routes.
12
12
 
13
13
  ::tip{icon="i-lucide-rocket"}
14
- During server-side rendering, calling `$fetch` to fetch your internal [API routes](/docs/guide/directory-structure/server) will directly call the relevant function (emulating the request), **saving an additional API call**.
14
+ During server-side rendering, calling `$fetch` to fetch your internal [API routes](/docs/4.x/guide/directory-structure/server) will directly call the relevant function (emulating the request), **saving an additional API call**.
15
15
  ::
16
16
 
17
17
  ::note{color="blue" icon="i-lucide-info"}
18
- Using `$fetch` in components without wrapping it with [`useAsyncData`](/docs/api/composables/use-async-data) causes fetching the data twice: initially on the server, then again on the client-side during hydration, because `$fetch` does not transfer state from the server to the client. Thus, the fetch will be executed on both sides because the client has to get the data again.
18
+ Using `$fetch` in components without wrapping it with [`useAsyncData`](/docs/4.x/api/composables/use-async-data) causes fetching the data twice: initially on the server, then again on the client-side during hydration, because `$fetch` does not transfer state from the server to the client. Thus, the fetch will be executed on both sides because the client has to get the data again.
19
19
  ::
20
20
 
21
21
  ## Usage
22
22
 
23
- We recommend using [`useFetch`](/docs/api/composables/use-fetch) or [`useAsyncData`](/docs/api/composables/use-async-data) + `$fetch` to prevent double data fetching when fetching the component data.
23
+ We recommend using [`useFetch`](/docs/4.x/api/composables/use-fetch) or [`useAsyncData`](/docs/4.x/api/composables/use-async-data) + `$fetch` to prevent double data fetching when fetching the component data.
24
24
 
25
25
  ```vue [app/app.vue]
26
26
  <script setup lang="ts">
@@ -95,4 +95,4 @@ const { data } = await useAsyncData(() => requestFetch('/api/cookies'))
95
95
  </script>
96
96
  ```
97
97
 
98
- However, when calling `useFetch` with a relative URL on the server, Nuxt will use [`useRequestFetch`](/docs/api/composables/use-request-fetch) to proxy headers and cookies (with the exception of headers not meant to be forwarded, like `host`).
98
+ However, when calling `useFetch` with a relative URL on the server, Nuxt will use [`useRequestFetch`](/docs/4.x/api/composables/use-request-fetch) to proxy headers and cookies (with the exception of headers not meant to be forwarded, like `host`).
@@ -9,7 +9,7 @@ links:
9
9
  ---
10
10
 
11
11
  ::warning
12
- `abortNavigation` is only usable inside a [route middleware handler](/docs/guide/directory-structure/app/middleware).
12
+ `abortNavigation` is only usable inside a [route middleware handler](/docs/4.x/guide/directory-structure/app/middleware).
13
13
  ::
14
14
 
15
15
  ## Type
@@ -9,7 +9,7 @@ links:
9
9
  ---
10
10
 
11
11
  ::note
12
- Route middleware are navigation guards stored in the [`app/middleware/`](/docs/guide/directory-structure/app/middleware) directory of your Nuxt application (unless [set otherwise](/docs/api/nuxt-config#middleware)).
12
+ Route middleware are navigation guards stored in the [`app/middleware/`](/docs/4.x/guide/directory-structure/app/middleware) directory of your Nuxt application (unless [set otherwise](/docs/4.x/api/nuxt-config#middleware)).
13
13
  ::
14
14
 
15
15
  ## Type
@@ -31,7 +31,7 @@ interface AddRouteMiddlewareOptions {
31
31
 
32
32
  Can be either a string or a function of type `RouteMiddleware`. Function takes the next route `to` as the first argument and the current route `from` as the second argument, both of which are Vue route objects.
33
33
 
34
- Learn more about available properties of [route objects](/docs/api/composables/use-route).
34
+ Learn more about available properties of [route objects](/docs/4.x/api/composables/use-route).
35
35
 
36
36
  ### `middleware`
37
37
 
@@ -61,7 +61,7 @@ await callOnce(async () => {
61
61
  :read-more{to="/docs/getting-started/state-management"}
62
62
 
63
63
  ::warning
64
- Note that `callOnce` doesn't return anything. You should use [`useAsyncData`](/docs/api/composables/use-async-data) or [`useFetch`](/docs/api/composables/use-fetch) if you want to do data fetching during SSR.
64
+ Note that `callOnce` doesn't return anything. You should use [`useAsyncData`](/docs/4.x/api/composables/use-async-data) or [`useFetch`](/docs/4.x/api/composables/use-fetch) if you want to do data fetching during SSR.
65
65
  ::
66
66
 
67
67
  ::note
@@ -24,6 +24,6 @@ clearError()
24
24
  clearError({ redirect: '/homepage' })
25
25
  ```
26
26
 
27
- Errors are set in state using [`useError()`](/docs/api/composables/use-error). The `clearError` composable will reset this state and calls the `app:error:cleared` hook with the provided options.
27
+ Errors are set in state using [`useError()`](/docs/4.x/api/composables/use-error). The `clearError` composable will reset this state and calls the `app:error:cleared` hook with the provided options.
28
28
 
29
29
  :read-more{to="/docs/getting-started/error-handling"}
@@ -20,4 +20,4 @@ clearNuxtData (keys?: string | string[] | ((key: string) => boolean)): void
20
20
 
21
21
  ## Parameters
22
22
 
23
- * `keys`: One or an array of keys that are used in [`useAsyncData`](/docs/api/composables/use-async-data) to delete their cached data. If no keys are provided, **all data** will be invalidated.
23
+ * `keys`: One or an array of keys that are used in [`useAsyncData`](/docs/4.x/api/composables/use-async-data) to delete their cached data. If no keys are provided, **all data** will be invalidated.
@@ -20,4 +20,4 @@ clearNuxtState (keys?: string | string[] | ((key: string) => boolean)): void
20
20
 
21
21
  ## Parameters
22
22
 
23
- - `keys`: One or an array of keys that are used in [`useState`](/docs/api/composables/use-state) to delete their cached state. If no keys are provided, **all state** will be invalidated.
23
+ - `keys`: One or an array of keys that are used in [`useState`](/docs/4.x/api/composables/use-state) to delete their cached state. If no keys are provided, **all state** will be invalidated.