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

36 Upvotes

33 comments sorted by

View all comments

Show parent comment

3

u/haschdisch Sep 14 '25

Colocation by component hierarchy scales much better in my experience. Route files tend to blur too much business domain and routing and it becomes quickly messy.

2

u/Impressive_Star959 Sep 17 '25

Can you provide an example of what colocation by component hierarchy means?

-1

u/mexicocitibluez Sep 14 '25

Route files tend to blur too much business domain and routing and it becomes quickly messy.

Spot on.

The times that I've tried to re-architect my app to use file-based routing it actually made it harder to navigate.