I am attempting to create a modal using parallel routes in Next.js version 13.4
.
Everything functions properly when I am on the homepage (/
) and open the modal by navigating to /login
.
However, if I refresh the /login
page, instead of displaying the homepage with the modal, it shows a 404
error page along with the modal:
https://i.sstatic.net/z1BP6.png
This is the structure of my folders:
https://i.sstatic.net/lmsQP.png
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>
);
}
Is there a way to display the home page (/
) when directly accessing the parallel route /login
?