#not-found.tsx inside route groups

18 messages · Page 1 of 1 (latest)

neat burrow
#

Can someone help me I have this problem where I have 2 route groups with 2 layout.tsx however I want to add a not-found.tsx but I can’t because I don’t have a global layout and putting the not-found.tsx inside one of the route groups doesn’t work. Thanks

hearty groveBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

hardy plover
#

Also putting the notfound.tsx in each of the route groups doesn't work?

neat burrow
#

cuz I have 2 whole different layouts with different providers on each of the layouts

#

Nah it gives me the default nextjs 404

hardy plover
#

It wont change anything

mystic cave
#

technicality you can import the layout form the group and import it into the root 404 page...

neat burrow
#

wouldn it mess with the performance if I have like 4 providers that aren’t even used on one side of the website

neat burrow
hardy plover
neat burrow
#

Ok I’ll try it brb

hardy plover
#

Also unless the route group is active the layout wont be loaded(iirc)

#

Put your providers in the route group layouts and in global root layout just return the children without any changes.

neat burrow
#

I didn’t know you can still have a global layout if you already have them in the route groups

mystic cave
#

you can have a route group for any folder...