Next.js Discord

Discord Forum

Route Group For Parallel Routes

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
Hey all, I am trying to use route groups to group my card components and use them in my layout, but my parallel routes for bar and foo are undefined in my layout when I try to reference them.

Here is my foder structure:
/root
 layout.tsx // This layout reference foo and bar.
  /(card) // Route group
    /@bar
      page.tsx
      loading.tsx
    /@foo
      page.tsx
      loading.tsx


Anyone know what I am doing wrong or how I can accomplish this?

8 Replies

Barbary LionOP
Am I able to accomplish it in the layout file below or does it have to be at the same level as the route group?
need to be same level
Barbary LionOP
Dang, I wish I could group and access the child layout. I can probably figure out how to get this to work actually.
Barbary LionOP
Hmm, that is not working. I'm not sure why.
Barbary LionOP
@Ray That did not work. It just rendered a 404 page.

/root
 layout.tsx // This layout just renders the children
  /(card) // Route group
  layout.tsx // this layout has foo and bar
    /@bar
      page.tsx
      loading.tsx
    /@foo
      page.tsx
      loading.tsx
Barbary LionOP
Wait, actually it works. I had something weird going on with an intercepted route
cool