T
TanStack2y ago
sensitive-blue

How to give better names for route.tsx / route.lazy.tsx

I have this nested mess, and i'd like to give some better naming. but I want to keep the functionality of the route/route.lazy obs whats the solution for this?
No description
7 Replies
conscious-sapphire
conscious-sapphire2y ago
There isn’t one but I could make something for it. You just want to be able to name the file whatever you want? But still have it used as the path location route?
sensitive-blue
sensitive-blueOP2y ago
yeah, from the docs I thought it would be possible to have name.route.tsx but i remember trying that and it didnt work
No description
conscious-sapphire
conscious-sapphire2y ago
Yeah route is mostly useful to target the path as the current directory.
sensitive-blue
sensitive-blueOP2y ago
I like having folder nesting, but when you have a complex routing its a bit hard. I find myself clicking on wrong routes quite a lot so something to allow a name before the route.tsx would be nice also im not sure if theres a way to use lazy load if I dont use folder nesting, correct me if im wrong.
sensitive-blue
sensitive-blueOP2y ago
but as you can see from the SS, I have some complex nesting stuff, so folder nesting is much more organized for me, but the naming is making it hard to navigate
No description
sensitive-blue
sensitive-blueOP2y ago
not only that, it effects the vscode dx when editing files
No description
sensitive-blue
sensitive-blueOP2y ago
because its the same name, it takes much more space to also show the path but it still hard to get by (the path is smaller and not as white) so yeah something like register-employee.route.tsx register-employee.route.lazy.tsx would be nice. or even shortcuts for that, like register-employee.r.tsx register-employee.lr.tsx (lazy route) or register-employee.rl.tsx (route-lazy) or maybe even check if the file name has the same name as the folder name. so you could just have a register-employee.tsx to be seen as the route or register-employee.lazy.tsx like, as you can see in the lower section. that small space aint really helping me to know which path is that, without going in the file, and realizing i picked the wrong one

Did you find this page helpful?