Opt-out root layout in dynamic routes
Answered
Cape lion posted this in #help-forum
Cape lionOP
Hello!
How should my folder structure be if I want to opt-out the root layout in my dynamic routes?
My current folder structure is:
I have tried:
and
without any luck.
The layout.tsx file for the dynamic routes is:
How should my folder structure be if I want to opt-out the root layout in my dynamic routes?
My current folder structure is:
src/
|--app/
|--demo/
|--[id]
|--page.tsx
|--page.tsxI have tried:
src/
|--app/
|--demo/
|--(wrapper)
|--[id]
|--layout.tsx
|--page.tsx
|--page.tsxand
src/
|--app/
|--demo/
|--[id]
|--(wrapper)
|--layout.tsx
|--page.tsx
|--page.tsxwithout any luck.
The layout.tsx file for the dynamic routes is:
import { Inter } from "next/font/google";
import React from "react";
const inter = Inter({ subsets: ["latin"] });
export default function Amk({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
</html>
);
}Answered by Cape lion
I did this to solve it https://nextjs.org/docs/app/building-your-application/routing/route-groups#creating-multiple-root-layouts don't know if you could do it without making two logical groups
2 Replies
Cape lionOP
I did this to solve it https://nextjs.org/docs/app/building-your-application/routing/route-groups#creating-multiple-root-layouts don't know if you could do it without making two logical groups
Answer
You have to use route groups