mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
- Enable newNextLinkBehavior. See #36436 - Run next/link codemod on test suite Note that from when this lands on apps trying canary will need to run the new-link codemod in order to upgrade. Ideally we have to detect `<a>` while rendering the new link and warn for it. Co-authored-by: Steven <[email protected]>
51 lines
1004 B
JavaScript
51 lines
1004 B
JavaScript
import Link from 'next/link'
|
|
import { useRouter } from 'next/router'
|
|
import { useEffect, useState } from 'react'
|
|
|
|
export default function Page(props) {
|
|
const router = useRouter()
|
|
const [mounted, setMounted] = useState(false)
|
|
|
|
useEffect(() => {
|
|
setMounted(true)
|
|
}, [])
|
|
|
|
return (
|
|
<>
|
|
<p id="page">another page</p>
|
|
<p id="props">{JSON.stringify(props)}</p>
|
|
<p id="router">
|
|
{JSON.stringify(
|
|
mounted
|
|
? {
|
|
basePath: router.basePath,
|
|
pathname: router.pathname,
|
|
asPath: router.asPath,
|
|
query: router.query,
|
|
}
|
|
: {}
|
|
)}
|
|
</p>
|
|
|
|
<Link href="/" id="to-index">
|
|
to /index
|
|
</Link>
|
|
<br />
|
|
|
|
<Link href="/dynamic/first" id="to-dynamic">
|
|
to /dynamic/first
|
|
</Link>
|
|
<br />
|
|
</>
|
|
)
|
|
}
|
|
|
|
export function getServerSideProps() {
|
|
return {
|
|
props: {
|
|
hello: 'world',
|
|
now: Date.now(),
|
|
},
|
|
}
|
|
}
|