feat(docs): better explanation of useNuxt()

This commit is contained in:
Andrey Yolkin 2023-08-16 01:21:00 +03:00
parent 9d69d77ebb
commit e416ef1bdd
1 changed files with 1 additions and 1 deletions

View File

@ -990,7 +990,7 @@ An object with the following properties:
[source code](https://github.com/nuxt/nuxt/blob/main/packages/kit/src/context.ts)
::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()`