TanStackT
TanStack12mo ago
3 replies
skinny-azure

Why specify route path in code for file-based routes?

Hi, I'm learning about TSR via the website docs. I noticed that, for file based routing, the route paths still need to be specified in code like this
export const Route = createFileRoute('/posts')({
  loader: fetchPosts,
  component: PostsComponent,
})


It seems to me the value "/posts" is implied by the file location and a typo would result in inconsistency. Could someone help me understand why that parameter is necessary?
Was this page helpful?