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