TanStackT
TanStack5mo ago
1 reply
ordinary-sapphire

Virtual physical routes

In virtual routesphysical('/posts', 'posts'),
└── posts
    ├── route.tsx (layout file not working)
    ├── index.tsx
    ├── $postId.tsx
    ├── $postId.edit.tsx
    ├── comments/
    │   ├── index.tsx
    │   ├── $commentId.tsx
    └── likes/
        ├── index.tsx
        ├── $likeId.tsx


└── posts
    ├── directory
    └─├── route.tsx (now working fine)
      ├── index.tsx
      ├── $postId.tsx
      ├── $postId.edit.tsx
      ├── comments/
      │   ├── index.tsx
      │   ├── $commentId.tsx
      └── likes/
          ├── index.tsx
          ├── $likeId.tsx

we need to create an additional directory to make route.tsx work as layout wrapper. it is expected behavior. https://stackblitz.com/edit/github-93ulbqhx?file=routes.ts in this official example this hack is found.
StackBlitzSteve Steinitz
Run official live example code for Router Basic Virtual File Based, created by Tan Stack on StackBlitz
Router Basic Virtual File Based Example - StackBlitz
Was this page helpful?