Skip to content
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
12 changes: 6 additions & 6 deletions docs/01-app/03-api-reference/01-directives/use-cache.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ Any non-serializable arguments, props, or closed-over values will turn into refe
For example, a cached function can take in JSX as a `children` prop and return `<div>{children}</div>`, but it won't be able to introspect the actual `children` object. This allows you to nest uncached content inside a cached component.

```tsx filename="app/ui/cached-component.tsx" switcher
function CachedComponent({ children }: { children: ReactNode }) {
async function CachedComponent({ children }: { children: ReactNode }) {
'use cache'
return <div>{children}</div>
}
```

```jsx filename="app/ui/cached-component.js" switcher
function CachedComponent({ children }) {
async function CachedComponent({ children }) {
'use cache'
return <div>{children}</div>
}
Expand Down Expand Up @@ -136,15 +136,15 @@ To pre-render an entire route, add `use cache` to the top of **both** the `layou
```tsx filename="app/layout.tsx" switcher
'use cache'

export default function Layout({ children }: { children: ReactNode }) {
export default async function Layout({ children }: { children: ReactNode }) {
return <div>{children}</div>
}
```

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

export default function Layout({ children }) {
export default async function Layout({ children }) {
return <div>{children}</div>
}
```
Expand All @@ -159,7 +159,7 @@ async function Users() {
// loop through users
}

export default function Page() {
export default async function Page() {
return (
<main>
<Users />
Expand All @@ -176,7 +176,7 @@ async function Users() {
// loop through users
}

export default function Page() {
export default async function Page() {
return (
<main>
<Users />
Expand Down
Loading