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

5

u/demnu Sep 15 '25

Code based 💯

Main reason being you have complete control on how you want to layout your code-base.

Also once set up it works exactly like react-router. There’s no need to learn a whole new way of setting up your code-base, naming your files etc.

The beauty in code-based is that you are in direct control and there is no ‘magic’ that is happening behind the scenes.