Replies: 4 comments 6 replies
-
|
If you rename the nested |
Beta Was this translation helpful? Give feedback.
-
|
I would like to know how to accomplish this as well. |
Beta Was this translation helpful? Give feedback.
-
|
Did anybody end up figuring out how to make this work? |
Beta Was this translation helpful? Give feedback.
-
|
Yes, slots in Next.js Parallel Routes can be effectively "overridden" by defining a more specific slot at a nested route level. Here's how it works: Default slot fallback: Overriding a slot at a nested route: text tsx {sidebar} {children} ); } When the user navigates to /dashboard, the @sidebar/dashboard/page.tsx is rendered instead of default.tsx — effectively overriding the slot for that route. So you don't "override" in the traditional sense, but you control slot content per-route by adding matching pages inside the slot folder. Hope that helps! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I realize slots can be a complex tool depending on what you're trying to achieve...
I wanted to clarify if slots can be defined more than once, with the "closest slot" to a certain route being the one that's being rendered in a higher-level layout?
My structure looks something like this:
When I'm navigating to
/profile/abcdefg, I'm seeing the initialslotA(the one defined in the root of /app). I was hoping I could render theslotAthat's nested insideprofile/[id]instead.It seems like Next will look at the
[id]folder and because there's no layout file that referencesslotA, it does not know what to do with this "second"slotAand therefore will fallback to the "first"slotA.Do layout and slot implementation always have to be on the same level?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions