Files
f260328900 BREAKING CHANGE: Enable newNextLinkBehavior (#41459)
- 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]>
2022-10-17 21:20:28 -04:00

49 lines
1011 B
JavaScript

import Link from 'next/link'
import { useRouter } from 'next/router'
export default function Page(props) {
if (useRouter().isFallback) {
return <p>Loading...</p>
}
return (
<>
<p id="props">{JSON.stringify(props)}</p>
<Link
href="/fallback-true-blog/first?hello=world"
shallow
id="to-query-shallow"
>
to /fallback-true-blog/first?hello=world
</Link>
<br />
<Link href="/fallback-true-blog/second" shallow id="to-no-query-shallow">
to /fallback-true-blog/second
</Link>
<br />
</>
)
}
export function getStaticPaths() {
return {
paths: [
'/fallback-true-blog/first',
'/fallback-true-blog/build-time-1',
'/fallback-true-blog/build-time-2',
'/fallback-true-blog/build-time-3',
'/fallback-true-blog/build-time-4',
],
fallback: true,
}
}
export function getStaticProps({ params }) {
return {
props: {
params,
time: Date.now(),
},
}
}