Unverified Commit 38e9bc97 authored by Delba de Oliveira's avatar Delba de Oliveira Committed by GitHub

Docs: Add missing diagram (#59008)

Slack feedback. Add missing diagram, and polish wording for `layout.tsx`
explanation.
parent 6fd3c3b9
...@@ -100,17 +100,15 @@ When using client-side navigation, Next.js automatically only renders the part o ...@@ -100,17 +100,15 @@ When using client-side navigation, Next.js automatically only renders the part o
For example, in the following directory structure, `dashboard/layout.tsx` is the common layout for both `/dashboard/settings` and `/dashboard/analytics`: For example, in the following directory structure, `dashboard/layout.tsx` is the common layout for both `/dashboard/settings` and `/dashboard/analytics`:
```txt highight={3} hideLineNumbers <Image
app alt="File structure showing a dashboard folder nesting a layout.tsx file, and settings and analytics folders with their own pages"
└── dashboard srcLight="/docs/light/shared-dashboard-layout.png"
├── layout.tsx srcDark="/docs/dark/shared-dashboard-layout.png"
├── settings width="1600"
│ └── page.tsx height="687"
└── analytics />
└── page.js
``` When navigating from `/dashboard/settings` to `/dashboard/analytics`, `page.tsx` in `/dashboard/analytics` will rerender on the server, while `dashboard/layout.tsx` will **not** rerender because it's a common UI shared between the two routes.
When navigating from `/dashboard/settings` to `/dashboard/analytics`, `page.tsx` in `/dashboard/analytics` will be rendered on the server because it is UI that changed, while `dashboard/layout.tsx` will **not** be re-rendered because it is a common UI between the two routes.
This performance optimization allows navigation between pages that share a layout to be quicker as only the data fetching and rendering for the page has to run, instead of the entire route that could include shared layouts that fetch their own data. This performance optimization allows navigation between pages that share a layout to be quicker as only the data fetching and rendering for the page has to run, instead of the entire route that could include shared layouts that fetch their own data.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment