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) Add missing JS-Code, cookies function names updated accordingly. #54703

Merged
merged 3 commits into from
Aug 30, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,20 @@ function SubmitButton() {
}
```

```jsx filename="app/page.jsx" switcher
'use client'

import { experimental_useFormStatus as useFormStatus } from 'react-dom'

function SubmitButton() {
const { pending } = useFormStatus()

return (
<button disabled={pending}>{pending ? 'Submitting...' : 'Submit'}</button>
)
}
```

> **Good to know:**
>
> - Displaying loading or error states currently requires using Client Components. We are exploring options for server-side functions to retrieve these values as we move forward in stability for Server Actions.
Expand Down Expand Up @@ -829,7 +843,7 @@ You can read cookies inside a Server Action using the [`cookies`](/docs/app/api-

import { cookies } from 'next/headers'

export async function create() {
export async function read() {
const auth = cookies().get('authorization')?.value
// ...
}
Expand All @@ -840,7 +854,7 @@ export async function create() {

import { cookies } from 'next/headers'

export async function create() {
export async function read() {
const auth = cookies().get('authorization')?.value
// ...
}
Expand Down Expand Up @@ -884,7 +898,7 @@ You can delete cookies inside a Server Action using the [`cookies`](/docs/app/ap

import { cookies } from 'next/headers'

export async function create() {
export async function delete() {
cookies().delete('name')
// ...
}
Expand All @@ -895,7 +909,7 @@ export async function create() {

import { cookies } from 'next/headers'

export async function create() {
export async function delete() {
cookies().delete('name')
// ...
}
Expand Down