mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
9d2824e995
Updates handling for app dir caching for edge runtime and adds additional tests. x-ref: NEXT-511 Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
19 lines
423 B
JavaScript
19 lines
423 B
JavaScript
import { cache, use } from 'react'
|
|
|
|
export default function Layout({ children }) {
|
|
const getData = cache(() =>
|
|
fetch('https://next-data-api-endpoint.vercel.app/api/random?layout', {
|
|
next: { revalidate: 10 },
|
|
}).then((res) => res.text())
|
|
)
|
|
const dataPromise = getData()
|
|
const data = use(dataPromise)
|
|
|
|
return (
|
|
<>
|
|
<p id="layout-data">revalidate 10: {data}</p>
|
|
{children}
|
|
</>
|
|
)
|
|
}
|