docs: added links to directory structure pages

This commit is contained in:
Nishant Aanjaney Jalan 2024-09-15 22:14:02 +05:30 committed by GitHub
parent 3404589337
commit ee861c2857
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -40,9 +40,9 @@ const handleClick = () => {
</template>
```
On the initial page load, the `counter` ref is initialised in the server since it is required inside the `<p>` tag. The contents of `handleClick` is never executed here. During hydration, the `counter` ref is initialised again. The `handleClick` finally binds itself to the button; This is why it is reasonable to deduce that the body of `handleClick` will always run in a browser environment.
On the initial request, the `counter` ref is initialised in the server since it is rendered inside the `<p>` tag. The contents of `handleClick` is never executed here. During hydration in the browser, the `counter` ref is re-initialised. The `handleClick` finally binds itself to the button; Therefore it is reasonable to deduce that the body of `handleClick` will always run in a browser environment.
Middlewares, pages, and plugins run in the server and on the client during hydration. You can restrict plugins to render on the server only or client only. Components can be forced to run on the client only as well. This is achieved by using the `.server` or `.client` suffix to their filenames. Composables and utility (`utils/`) are rendered based on the context of their usage.
[Middlewares](/docs/2.guide/2.directory-structure/1.middleware.md) and [pages](/docs/2.guide/2.directory-structure/1.pages.md) run in the server and on the client during hydration. [Plugins](/docs/2.guide/2.directory-structure/1.plugins.md) can be rendered on the server or client or both. [Components](/docs/2.guide/2.directory-structure/1.components.md) can be forced to run on the client only as well. This is achieved by using the `.server` or `.client` suffix to their filenames. [Composables](/docs/2.guide/2.directory-structure/1.composables.md) and [utilities](/docs/2.guide/2.directory-structure/1.utils.md) are rendered based on the context of their usage.
**Benefits of server-side rendering:**
- **Performance**: Users can get immediate access to the page's content because browsers can display static content much faster than JavaScript-generated content. At the same time, Nuxt preserves the interactivity of a web application during the hydration process.