Next.js Discord

Discord Forum

Need help with routing

Answered
Abhii posted this in #help-forum
Open in Discord
Avatar
This is the code of /showcase/[slug]/page.js

import LayoutWrapper from "@/components/LayoutWrapper"; import AwardsPage from "../../../components/Awards/AwardsPage"; import ScrollMarquee from "@/components/ui/ScrollMarquee"; import AwardsMarquee from "@/components/Awards/AwardsMarquee"; import AnimatedLayout from "@/components/ui/Layout/AnimatedLayout"; import RotatingWords from "@/components/r3f/RotatingWords"; import StarAnimation from "@/components/r3f/Frames/StarAnimation"; import MagzineAnimation from "@/components/ui/Layout/MagzineAnimation"; import { notFound, redirect } from "next/navigation"; import LayoutDashboard from "@/components/ui/Layout/LayoutDashboard"; export default async function Page({ params }) { if (params.slug === "avengers") { return ( <div> <AwardsPage /> </div> ); } if (params.slug === "directors") { return ( <LayoutWrapper> <div className=" h-screen w-full uppercase font-thunder "> <AwardsMarquee /> </div> </LayoutWrapper> ); } if (params.slug === "about") { return ( <LayoutWrapper> <div className="flex relative justify-center items-center text-6xl h-screen w-full uppercase font-thunder"> <div className="h-screen w-full top-0 right-0 absolute"> <StarAnimation /> </div> About </div> </LayoutWrapper> ); } if (params.slug === "magazine") { return ( <LayoutWrapper> <MagzineAnimation /> </LayoutWrapper> ); } if (params.slug === "r3f") { return ( <LayoutWrapper> <RotatingWords /> </LayoutWrapper> ); } return redirect(/showcase/${params.slug}); }
Image
Answered by Abhii
Issue was i had created layout file inside [slug] , i just noticed 😂 . Its fixed.
View full answer

3 Replies

Avatar
when i hit layout route its redirect at 404 page
Avatar
West African Lion
Can you show me the full URL in your browser
Avatar
Issue was i had created layout file inside [slug] , i just noticed 😂 . Its fixed.
Answer