Can I have layout over my whole app except one route?
I currently have a sidebar setup in my root index.tsx file
src/routes/index.tsx but I have an auth route for login and signining up
but let's say i want to add a profile/ directory with profile/index.tsx route and a directory gallery/ with gallery.tsx
How can I have those inherit the layout from the root index.tsx? is that possible, I would like to have the main app in / but I am having a hard time wrapping my head around it7 Replies
like-gold•9mo ago
How can I have those inherit the layout from the root index.tsxthats not possible at all since index.tsx is a leaf you might mean
__root.tsx
you can opt out of the parent layout by adding a _ suffixevident-indigoOP•9mo ago
Oh so anything that has
_ suffix does not inherit a layout?like-gold•9mo ago
does not a inherit its parent ui
evident-indigoOP•9mo ago
ok thank you so much i'll thinker around with that 🙏 tysm
hmm that didn't seem to work. I extracted this
sidebar to its own component but when I try to go to my _auth routes i get:
my layout component:
my root.tsx
i think for now what i can do is just place everything in an (_app) directory - should be fine no need for that much magic
hmm actually even doing that i added a new route inside the _app directory called listings.tsx
and get the same error
my sidebar component has this:
when i comment it out it works so that's probably the issue
```ts
const { user } = useRouteContext({ from: "_root" });
```
seems to be the way
the suffix doesn't seem to work with my pathless layout, ill just do the _app waymultiple-amethyst•9mo ago
do you want a pathless layout?
multiple-amethyst•9mo ago
i think what you want is like my dashboard look in the WIP branch. thats where i was tinkering with layouts and and routes for my sidebar
https://github.com/Succatash/denoTanstackStart
GitHub
GitHub - Succatash/denoTanstackStart
Contribute to Succatash/denoTanstackStart development by creating an account on GitHub.
multiple-amethyst•9mo ago
add a Outlet instead of {children}