file-based routing and nested paths (seems to be broken)
While rewriting my code-based routing app to a file-based one, I faced a strange thing — I can’t figure out how to create nested paths. During my searches for similar issues in history, I came across a few now-closed issues on gh like https://github.com/TanStack/router/issues/832 , but they were of no help for me 😭
I’ve reproduced bug (?) in a devbox here: https://codesandbox.io/p/devbox/6k9wl6
And here is a working example with code-based routing: https://codesandbox.io/p/devbox/xnktj8
Is this my thing or router’s? If it’s my code, how can I fix it?
GitHub
File-based routing doesn't support nested routes · Issue #832 · Tan...
Describe the bug Not sure if this is a bug report or a feature request. Nested routes don't seem to work out of the box with file-based routing. The CLI uses the root as every route's paren...
3 Replies
quickest-silver•11mo ago
an index route is always a leaf
you can rename those index files to "route.tsx"
see https://codesandbox.io/p/devbox/filerouter-nesting-error-forked-gg2gdy?workspaceId=04406bc7-9c73-4451-92ef-24aa90aec666
rare-sapphireOP•11mo ago
wow, thank you! It seems I didn’t read the mentioned issue carefully enough :FD_sad_cat:
quickest-silver•11mo ago
I guess we need to work on our docs to make this clearer