Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix typos in 08-mutating-data.mdx #74856

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
docs: fix typos in 08-mutating-data.mdx
  • Loading branch information
JamBalaya56562 committed Jan 14, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 49ed7389454e91e8dba3ef9b08d89a0fbee87b52
11 changes: 7 additions & 4 deletions docs/01-app/01-getting-started/08-mutating-data.mdx
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ export async function deletePost(formData) {}
Server Functions can be inlined in Server Components by adding the `"use server"` directive to the top of the function body:

```tsx filename="app/page.tsx" switcher
export async default function Page() {
export default function Page() {
// Server Action
async function createPost() {
'use server'
@@ -66,7 +66,7 @@ export default function Page() {

It's not possible to define Server Functions in Client Components. However, you can invoke them in Client Components by importing them from a file that has the `"use server"` directive at the top of it:

```tsx filename="app/actions.ts" switcher
```ts filename="app/actions.ts" switcher
'use server'

export async function createPost() {}
@@ -139,7 +139,7 @@ export function Form() {
}
```

```tsx filename="app/actions.ts" switcher
```ts filename="app/actions.ts" switcher
'use server'

export async function createPost(formData: FormData) {
@@ -151,7 +151,7 @@ export async function createPost(formData: FormData) {
}
```

```jsx filename="app/actions.js" switcher
```js filename="app/actions.js" switcher
'use server'

export async function createPost(formData) {
@@ -189,6 +189,9 @@ export default function LikeButton({ initialLikes }: { initialLikes: number }) {
>
Like
</button>
</>
)
}
```

```jsx filename="app/like-button.js" switcher