Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
f8fddfa1
Unverified
Commit
f8fddfa1
authored
Nov 28, 2024
by
LioRael
Committed by
GitHub
Nov 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: add await before headers() and cookies() calls (#73315)
parent
f5b88d91
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
next-dynamic-api-wrong-context.mdx
errors/next-dynamic-api-wrong-context.mdx
+5
-5
No files found.
errors/next-dynamic-api-wrong-context.mdx
View file @
f8fddfa1
...
@@ -17,9 +17,9 @@ Example:
...
@@ -17,9 +17,9 @@ Example:
```diff filename="app/page.js"
```diff filename="app/page.js"
import { cookies } from 'next/headers'
import { cookies } from 'next/headers'
- const cookieStore = cookies()
- const cookieStore =
await
cookies()
export default function Page() {
export default
async
function Page() {
+ const cookieStore = cookies()
+ const cookieStore =
await
cookies()
return ...
return ...
}
}
```
```
...
@@ -27,9 +27,9 @@ export default function Page() {
...
@@ -27,9 +27,9 @@ export default function Page() {
```diff filename="app/foo/route.js"
```diff filename="app/foo/route.js"
import { headers } from 'next/headers'
import { headers } from 'next/headers'
- const headersList = headers()
- const headersList =
await
headers()
export async function GET() {
export async function GET() {
+ const headersList = headers()
+ const headersList =
await
headers()
return ...
return ...
}
}
```
```
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment