I'm trying building modal using parallel routes in Next.js 13.4
.
It works when I'm on the homepage (/
) and open the modal (push to /login
).
But when I refresh the /login
page, instead of showing homepage with modal, it shows the 404
page with the modal:
This is my folder structure:
This is @overlays/login/page.tsx
:
'use client';
import {useRouter} from 'next/navigation';
import {Dialog} from '@mui/material';
export default function Page() {
const router = useRouter();
return (
<Dialog
open
onClose={router.back}
keepMounted
disablePortal
>
Hello
</Dialog>
);
}
Could you tell me how to render the home page (/
) when navigating directly on parallel route /login
?