TanStackT
TanStack2y ago
1 reply
brilliant-lime

index.tsx vs index.route.tsx

I'm reading this part: https://tanstack.com/router/latest/docs/framework/react/guide/code-splitting#encapsulating-a-routes-files-into-a-directory

Specifically:
For example, if you have a route file named posts.tsx, you would create a new directory named posts and move the posts.tsx file into that directory, renaming it to index.route.tsx.

What's the difference between naming the file index.tsx and index.route.tsx? The end result is the same, I still get the route on /posts/ and not /posts
Code splitting and lazy loading is a powerful technique for improving the bundle size and load performance of an application.

Reduces the amount of code that needs to be loaded on initial page load
Was this page helpful?