You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/docs/content/en/docs/01-app/01-getting-started/04-images.mdx
+38-2Lines changed: 38 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,6 +58,41 @@ export default function Page() {
58
58
<Image
59
59
src="/profile.png"
60
60
alt="Picture of the author"
61
+
width={500}
62
+
height={500}
63
+
/>
64
+
)
65
+
}
66
+
```
67
+
68
+
```jsx filename="app/page.js" switcher
69
+
importImagefrom'next/image'
70
+
71
+
exportdefaultfunctionPage() {
72
+
return (
73
+
<Image
74
+
src="/profile.png"
75
+
alt="Picture of the author"
76
+
width={500}
77
+
height={500}
78
+
/>
79
+
)
80
+
}
81
+
```
82
+
83
+
### Statically imported images
84
+
85
+
You can also import and use local image files. Next.js will automatically determine the intrinsic [`width`](/docs/app/api-reference/components/image#width-and-height) and [`height`](/docs/app/api-reference/components/image#width-and-height) of your image based on the imported file. These values are used to determine the image ratio and prevent [Cumulative Layout Shift](https://web.dev/articles/cls) while your image is loading.
86
+
87
+
```tsx filename="app/page.tsx" switcher
88
+
importImagefrom'next/image'
89
+
importProfileImagefrom'./profile.png'
90
+
91
+
exportdefaultfunction Page() {
92
+
return (
93
+
<Image
94
+
src={ProfileImage}
95
+
alt="Picture of the author"
61
96
// width={500} automatically provided
62
97
// height={500} automatically provided
63
98
// blurDataURL="data:..." automatically provided
@@ -69,11 +104,12 @@ export default function Page() {
69
104
70
105
```jsx filename="app/page.js" switcher
71
106
importImagefrom'next/image'
107
+
importProfileImagefrom'./profile.png'
72
108
73
109
exportdefaultfunctionPage() {
74
110
return (
75
111
<Image
76
-
src="/profile.png"
112
+
src={ProfileImage}
77
113
alt="Picture of the author"
78
114
// width={500} automatically provided
79
115
// height={500} automatically provided
@@ -84,7 +120,7 @@ export default function Page() {
84
120
}
85
121
```
86
122
87
-
When using local images, Next.js will automatically determine the intrinsic [`width`](/docs/app/api-reference/components/image#width-and-height) and [`height`](/docs/app/api-reference/components/image#width-and-height) of your image based on the imported file. These values are used to determine the image ratio and prevent [Cumulative Layout Shift](https://web.dev/articles/cls) while your image is loading.
123
+
In this case, Next.js expects the `app/profile.png`fileto be available.
> - This option replaces the `fallback: true | false | blocking` option of `getStaticPaths` in the `pages` directory.
88
88
> - To statically render all paths the first time they're visited, you'll need to return an empty array in `generateStaticParams` or utilize `export const dynamic = 'force-static'`.
89
89
> - When `dynamicParams = true`, the segment uses [Streaming Server Rendering](/docs/app/building-your-application/routing/loading-ui-and-streaming#streaming-with-suspense).
90
-
> - If the `dynamic = 'error'` and `dynamic = 'force-static'` are used, it'll change the default of `dynamicParams` to `false`.
Copy file name to clipboardExpand all lines: apps/docs/content/en/docs/01-app/05-api-reference/04-functions/use-report-web-vitals.mdx
+74-56Lines changed: 74 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,15 +7,19 @@ description: API Reference for the useReportWebVitals function.
7
7
8
8
The `useReportWebVitals` hook allows you to report [Core Web Vitals](https://web.dev/vitals/), and can be used in combination with your analytics service.
9
9
10
+
New functions passed to `useReportWebVitals` are called with the available metrics up to that point. To prevent reporting duplicated data, ensure that the callback function reference does not change (as shown in the code examples below).
Copy file name to clipboardExpand all lines: apps/docs/content/en/learn/02-dashboard-app/12-mutating-data.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -298,7 +298,7 @@ export async function createInvoice(formData: FormData) {
298
298
299
299
Now that you have all the values you need for your database, you can create an SQL query to insert the new invoice into your database and pass in the variables:
@@ -363,7 +363,7 @@ Once the database has been updated, the `/dashboard/invoices` path will be reval
363
363
364
364
At this point, you also want to redirect the user back to the `/dashboard/invoices` page. You can do this with the [`redirect`](/docs/app/api-reference/functions/redirect) function from Next.js:
365
365
366
-
```ts {6,14} filename="/app/lib/actions.ts"
366
+
```ts {5,16} filename="/app/lib/actions.ts"
367
367
'use server';
368
368
369
369
import {z} from 'zod';
@@ -488,7 +488,7 @@ Notice how it's similar to your `/create` invoice page, except it imports a diff
488
488
489
489
In addition to `searchParams`, page components also accept a prop called `params` which you can use to access the `id`. Update your `<Page>` component to receive the prop:
0 commit comments