import Link from 'next/link' import { useRouter } from 'next/router' import { useEffect } from 'react' import { useState } from 'react' export default function Page(props) { const router = useRouter() const parsedAs = new URL(router.asPath, 'http://n') const [asPath, setAsPath] = useState(parsedAs.pathname) useEffect(() => { if (router.isReady && router.asPath && asPath !== router.asPath) { setAsPath(router.asPath) } }, [router.asPath, router.isReady, asPath]) return ( <>

index page

{JSON.stringify(props)}

{router.locale}

{router.defaultLocale}

{JSON.stringify(router.locales)}

{JSON.stringify(router.domainLocales)}

{JSON.stringify(router.query)}

{router.pathname}

{asPath}

to /another
to /dynamic/first
to /gsp
to /gsp/fallback/first
to /gsp/fallback/hello
to /gsp/no-fallback/first
to /gssp
to /gssp/first
to /api/post/[slug] to https://nextjs.org/
) } export const getStaticProps = ({ locale, locales, defaultLocale }) => { return { props: { locale, locales, defaultLocale, }, } }