My current folder structure is as follows:
routes/
├── _index.tsx
└── contacts.$contactId.tsx
I want to use _index.tsx as the layout for /contacts/$contactId and other routes, but currently, /contacts/$contactId is being rendered as a separate route instead of as a child route of _index.tsx.
I tried using root.tsx as the base, but it limits flexibility because I want to render different layouts (footer, menu, etc.) for different sections, such as the admin page. To my knowledge, it’s not possible to override the Layout export from root.tsx.
The _index.tsx file contains an Outlet component. I expected that routes matching _index.tsx (like /contacts/$contactId) would automatically be rendered inside _index's Outlet. However, they are being rendered in the root.tsx Outlet instead.
Could anyone help me resolve this issue?