next.js/test/e2e/app-dir/app-static/app/variable-revalidate-edge/layout.js
layout.js19 lines423 B
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}
    </>
  )
}
Quest for Codev2.0.0
/
SIGN IN