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: docs/01-app/01-getting-started/07-updating-data.mdx
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
-
title: How to mutate data
3
-
nav_title: Mutating Data
4
-
description: Learn how to mutate data in your Next.js application.
2
+
title: How to update data
3
+
nav_title: Updating Data
4
+
description: Learn how to update data in your Next.js application.
5
5
related:
6
6
title: API Reference
7
7
description: Learn more about the features mentioned in this page by reading the API Reference.
@@ -11,7 +11,7 @@ related:
11
11
- app/api-reference/functions/redirect
12
12
---
13
13
14
-
You can mutate data in Next.js using React's [Server Functions](https://react.dev/reference/rsc/server-functions). This page will go through how you can [create](#creating-server-functions) and [invoke](#invoking-server-functions) Server Functions.
14
+
You can update data in Next.js using React's [Server Functions](https://react.dev/reference/rsc/server-functions). This page will go through how you can [create](#creating-server-functions) and [invoke](#invoking-server-functions) Server Functions.
15
15
16
16
## Creating Server Functions
17
17
@@ -42,7 +42,7 @@ export default function Page() {
42
42
// Server Action
43
43
asyncfunction createPost() {
44
44
'use server'
45
-
//Mutate data
45
+
//Update data
46
46
// ...
47
47
48
48
return <></>
@@ -54,7 +54,7 @@ export default function Page() {
54
54
// Server Action
55
55
asyncfunction createPost() {
56
56
'use server'
57
-
//Mutate data
57
+
//Update data
58
58
// ...
59
59
}
60
60
@@ -146,7 +146,7 @@ export async function createPost(formData: FormData) {
146
146
const title =formData.get('title')
147
147
const content =formData.get('content')
148
148
149
-
//Mutate data
149
+
//Update data
150
150
// Revalidate cache
151
151
}
152
152
```
@@ -158,7 +158,7 @@ export async function createPost(formData) {
158
158
const title =formData.get('title')
159
159
const content =formData.get('content')
160
160
161
-
//Mutate data
161
+
//Update data
162
162
// Revalidate cache
163
163
}
164
164
```
@@ -261,15 +261,15 @@ export function Button() {
261
261
262
262
### Revalidating the cache
263
263
264
-
After performing a mutation, you can revalidate the Next.js cache and show the updated data by calling [`revalidatePath`](/docs/app/api-reference/functions/revalidatePath) or [`revalidateTag`](/docs/app/api-reference/functions/revalidateTag) within the Server Function:
264
+
After performing an update, you can revalidate the Next.js cache and show the updated data by calling [`revalidatePath`](/docs/app/api-reference/functions/revalidatePath) or [`revalidateTag`](/docs/app/api-reference/functions/revalidateTag) within the Server Function:
@@ -282,23 +282,23 @@ export async function createPost(formData: FormData) {
282
282
import { revalidatePath } from'next/cache'
283
283
284
284
exportasyncfunction createPost(formData) {
285
-
//Mutate data
285
+
//Update data
286
286
// ...
287
287
revalidatePath('/posts')
288
288
}
289
289
```
290
290
291
291
### Redirecting
292
292
293
-
You may want to redirect the user to a different page after performing a mutation. You can do this by calling [`redirect`](/docs/app/api-reference/functions/redirect) within the Server Function:
293
+
You may want to redirect the user to a different page after performing an update. You can do this by calling [`redirect`](/docs/app/api-reference/functions/redirect) within the Server Function:
Copy file name to clipboardExpand all lines: docs/01-app/03-building-your-application/11-upgrading/08-single-page-applications.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,7 @@ export default function RootLayout({ children }) {
79
79
}
80
80
```
81
81
82
-
While you can [defer and pass a single Promise](/docs/app/getting-started/data-fetching-and-streaming#with-the-use-hook) as a prop to a client component, we generally see this pattern paired with a React context provider. This enables easier access from client components with a custom React hook.
82
+
While you can [defer and pass a single Promise](/docs/app/getting-started/fetching-data#with-the-use-hook) as a prop to a client component, we generally see this pattern paired with a React context provider. This enables easier access from client components with a custom React hook.
83
83
84
84
You can forward a Promise to the React context provider:
0 commit comments