TanStackT
TanStack2y ago
16 replies
correct-teal

Opting out of parent layout(s) in child route?

Is there a way to opt-out of the parent layout(s) from a child route using the file-based router?
Take this structure for example:
-dashboard
– _root.tsx
– _other.tsx
– _root._other.customers <--- Directory for grouping
–––– index.tsx
–––– $customerId.tsx <-- This should only have the `_root` layout, but not the `_other` layout

Is there some way to opt out of _other layout for the path of /dashboard/customers/$customerId while keeping it in the same file structure?
Keep in mind, _other is used by other routes as well (say customers and orders), but shouldn't be used by some of the nested ones (like customers/$customerId or orders/$orderId)
Was this page helpful?