Files
JJ KasperandGitHub 916e21f913 Update manual basePath with trailingSlash (#51726)
With the manualBasePath config we still need to normalize the trailing
slash per that config.

x-ref: [slack
thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1687543336964799?thread_ts=1687487533.019499&cid=C03S8ED1DKM)
2023-06-23 15:36:16 -07:00

47 lines
991 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">index 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="/another" id="to-another">
to /another
</Link>
<br />
<Link href="/another/" id="to-another-slash">
to /another
</Link>
<br />
<Link href="/dynamic/first" id="to-dynamic">
to /dynamic/first
</Link>
<br />
</>
)
}