f260328900
- 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 <steven@ceriously.com>
43 lines
991 B
JavaScript
43 lines
991 B
JavaScript
import Link from 'next/link'
|
|
import { useRouter } from 'next/router'
|
|
|
|
export default function Shallow({ message }) {
|
|
const { pathname, query } = useRouter()
|
|
return (
|
|
<div>
|
|
<ul>
|
|
<li id="message-contents">{message}</li>
|
|
<li>
|
|
<Link href="/sha?hello=world" shallow id="shallow-link">
|
|
Shallow link to ?hello=world
|
|
</Link>
|
|
</li>
|
|
<li>
|
|
<Link href="/sha?hello=goodbye" id="deep-link">
|
|
Deep link to ?hello=goodbye
|
|
</Link>
|
|
</li>
|
|
<li>
|
|
<h1 id="pathname">
|
|
Current path: <code>{pathname}</code>
|
|
</h1>
|
|
</li>
|
|
<li>
|
|
<h2 id="query" data-query-hello={query.hello}>
|
|
Current query: <code>{JSON.stringify(query)}</code>
|
|
</h2>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
let i = 0
|
|
|
|
export const getServerSideProps = () => {
|
|
return {
|
|
props: {
|
|
message: `Random: ${++i}${Math.random()}`,
|
|
},
|
|
}
|
|
}
|