next.js/test/e2e/app-dir/actions/app/action-discarding/layout.js
layout.js25 lines636 B
import Link from 'next/link'
import { connection } from 'next/server'

export default async function Layout({ children }) {
  await connection()

  const cachedRandom = await fetch(
    'https://next-data-api-endpoint.vercel.app/api/random?key=cached-random',
    { next: { tags: ['cached-random'] } }
  ).then((res) => res.text())
  return (
    <div>
      <div>
        Cached Random: <span id="cached-random">{cachedRandom}</span>
      </div>
      <div>
        <Link id="navigate-destination" href="/action-discarding/destination">
          Navigate to Destination
        </Link>
      </div>
      {children}
    </div>
  )
}
Quest for Codev2.0.0
/
SIGN IN