next.js/test/e2e/app-dir/router-autoscroll/app/layout.tsx
layout.tsx48 lines933 B
'use client'

import Link from 'next/link'
import React, { Suspense, useEffect } from 'react'
import { useRouter } from 'next/navigation'

export default function Layout({ children }: { children: React.ReactNode }) {
  const router = useRouter()

  // We export these so that we can access them from tests
  useEffect(() => {
    // @ts-ignore
    window.router = router
    // @ts-ignore
    window.React = React
  }, [router])

  return (
    <Suspense
      fallback={
        <html>
          <body />
        </html>
      }
    >
      <html>
        <head></head>
        <body
          style={{
            margin: 0,
          }}
        >
          <div
            style={{
              position: 'fixed',
              top: 0,
              left: 0,
            }}
          >
            <Link id="to-vertical-page" href="1" />
          </div>
          {children}
        </body>
      </html>
    </Suspense>
  )
}
Quest for Codev2.0.0
/
SIGN IN