Next.js Discord

Discord Forum

not-found.tsx root layout issue

Answered
Chinese Alligator posted this in #help-forum
Open in Discord
Chinese AlligatorOP
Using App Router, I have a page.tsx and layout.tsx at the root level, and i have a not-found.tsx. The issue is the not-found is rendered above the layout coming from the root layout.tsx. How do i render the not-found without the root layout?

4 Replies

Answer
Orangetailed potter wasp
you might want to check this out
As mentioned above you'll probably want to create a route group by using the parentheses folder at the top level. i.e. so you should have your layout.tsx and then not-found.tsx in your route group
Chinese AlligatorOP
thank you both, that worked extremely well!