Following the YT tutorial, around hour and 30 minutes in there is a description of parallel routes recommending the https://github.com/vercel/nextgram example. Unfortunately, using the code from this example causes a 404 error.
I'm unsure what is going on. This is my folder structure:
"use client";
import { type ElementRef, useEffect, useRef } from "react";
import { useRouter } from "next/navigation";
import { createPortal } from "react-dom";
export function Modal({ children }: { children: React.ReactNode }) {
const router = useRouter();
const dialogRef = useRef<ElementRef<"dialog">>(null);
useEffect(() => {
if (!dialogRef.current?.open) {
dialogRef.current?.showModal();
}
}, []);
function onDismiss() {
router.back();
}
return createPortal(
<div className="modal-backdrop">
<dialog ref={dialogRef} className="modal" onClose={onDismiss}>
{children}
<button onClick={onDismiss} className="close-button" />
</dialog>
</div>,
document.getElementById("modal-root")!,
);
}
both default.tsx files just return null:
export default function Default() {
return null;
}
Expected behavior is to render the gallery on home route, change the route on click and show the modal, however instead of the gallery on houme route I get a 404 error. In the console this error is clarified as:
Following the YT tutorial, around hour and 30 minutes in there is a description of parallel routes recommending the https://github.com/vercel/nextgram example. Unfortunately, using the code from this example causes a 404 error.
I'm unsure what is going on. This is my folder structure:![image](https://github.com/t3dotgg/t3gallery/assets/3895750/2a1ab850-3901-442a-b887-ece352ff4ff4)
Here's the root layout:
Here's page.tsx in the
img/[id]
:page.tsx in the
@modal/(.)img/[id]
:and modal.tsx next to it:
both default.tsx files just return null:
Expected behavior is to render the gallery on home route, change the route on click and show the modal, however instead of the gallery on houme route I get a 404 error. In the console this error is clarified as:
So does Next just not see the
@modal
at all?