next.js/test/e2e/app-dir/use-cache-swr/app/delayed/page.tsx
page.tsx25 lines438 B
import { cacheLife } from 'next/cache'
import { connection } from 'next/server'
import { setTimeout } from 'timers/promises'

async function Cached() {
  'use cache'

  cacheLife('seconds')

  await setTimeout(1000)

  return <p id="cached">{new Date().toISOString()}</p>
}

export default async function Page() {
  await connection()

  return (
    <>
      <p id="dynamic">{new Date().toISOString()}</p>
      <Cached />
    </>
  )
}
Quest for Codev2.0.0
/
SIGN IN