mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
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)
47 lines
991 B
JavaScript
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 />
|
|
</>
|
|
)
|
|
}
|