r/reactjs • • Sep 14 '25

Discussion File-based routing vs code-based routing in TanStack router, which one do you use and why?

[deleted] — view deleted post

35 Upvotes

33 comments sorted by

View all comments

20

u/mistyharsh Sep 14 '25 edited Sep 14 '25

I use code-based routing for three reasons: First, for large-scale applications! This helps to organize code in modules/context so that all the code related to that concern is together. Further, our file names are always upper camel cased and so having code-based routing helps keep the pattern intact.

And third, I used Rspack for many projects. Initially, file-based routing was only supported with Vite.

But for any other small apps, I almost always use file-based routing.