Next.js Discord

Discord Forum

Preventing nested layouts

Answered
Cattle Egret posted this in #help-forum
Open in Discord
Cattle EgretOP
How to prevent nested layouts like i want a layout for / page and a completely different layout which don't share anything from root layout to /test path

8 Replies

route groups
Answer
@Yi Lon Ma route groups
Cattle EgretOP
but it doesn't seem to work for me,
Here is my file ss
your root page.tsx and layout.tsx should be in a group of its own
so you folder would look like:
app
  - (home)
    - page.tsx
    - layout.tsx
  - (admin)
    - layout.tsx
    - admin
      - page.tsx
you can rename home to anything you like
@Yi Lon Ma your root page.tsx and layout.tsx should be in a group of its own
Cattle EgretOP
got it lemme try
AHA working. Thank you so much!