mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-18 14:41:25 +00:00
feat(docs): better explanation of useNuxt()
This commit is contained in:
parent
9d69d77ebb
commit
e416ef1bdd
@ -990,7 +990,7 @@ An object with the following properties:
|
|||||||
[source code](https://github.com/nuxt/nuxt/blob/main/packages/kit/src/context.ts)
|
[source code](https://github.com/nuxt/nuxt/blob/main/packages/kit/src/context.ts)
|
||||||
|
|
||||||
::alert{type=info}
|
::alert{type=info}
|
||||||
Keep in mind, Nuxt already pass itself as the second argument to the `setup` function, so you can use it instead of `useNuxt()` call. `useNuxt()` and `tryUseNuxt()` calls are useful when you want to access Nuxt in separate functions. You can look at [Nuxt Site Config](https://github.com/harlan-zw/nuxt-site-config) as a reference.
|
When you're working with the `setup` function in Nuxt modules, Nuxt is already provided as the second argument. This means you can directly utilize it without needing to call `useNuxt()`. However, if you want to access Nuxt from other functions, then you can use `useNuxt()` or `tryUseNuxt()`. You can look at [Nuxt Site Config](https://github.com/harlan-zw/nuxt-site-config) as an example of usage.
|
||||||
::
|
::
|
||||||
|
|
||||||
### `useNuxt()`
|
### `useNuxt()`
|
||||||
|
Loading…
Reference in New Issue
Block a user