Replies: 4 comments 6 replies
-
This. Colocation should be an exception, not the norm. I will definitely switch to |
Beta Was this translation helpful? Give feedback.
-
It's been a year, any status on Thanks |
Beta Was this translation helpful? Give feedback.
-
I've migrated 3 production (small to medium sized) apps to the And now I find the needs for colocation, but I'm just prefixing So far, all of my colocation needs are to have tsx components in the same folder (including shadcn's DataTable), not tricky file types such as Here's my typical use case:
Now, I just want to get rid of |
Beta Was this translation helpful? Give feedback.
-
Sorry to hijack this discussion but it's not working for me on my side here is my folder structure. I am currently on the latest version of remix. It does not show anything on the expected routes using node version @remix-run/node: ^2.8.1
@remix-run/react: ^2.8.1
@remix-run/serve: ^2.8.1
remix-flat-route: ^0.6.4
vite: ^5.1.0 |
Beta Was this translation helpful? Give feedback.
-
Remix has published the new
v2
routing convention and is a more strict flat-routes convention. Ryan doesn't appear interested in incorporating any of the more enhanced features into the core library.I think it would be a good idea to create a new project called
remix-hybrid-routes
.One of the main goals would be to be flexible but simplify the convention.
Requirements
All routes can use
.
or/
as route separators, whichever you prefer. So you can have:a.b.c.d.tsx
ora/b/c/d.tsx
or anywhere between.So how does that affect colocation? In
v2
andremix-flat-routes
a folder automatically opts-in to colocation. So you can no longer use folders just for route organization. That is why I introduced the+
suffix for folders. They let you use folders for organization instead of colocation.With
remix-hybrid-routes
, I think it should be the opposite. Whereasremix-flat-routes
had to maintain compatibility with the flat routes spec,remix-hybrid-routes
can do whatever we like. I feel that organization is much more common than colocation.All index routes (default route for a path) will be named
_index
like inv2
._layout
in a folder will be the layout for all routes in that folder (including child routes)Use the
+
suffix to specify the contents of this folder are colocated. The route file isindex.tsx
, any other file is ignored.Parent layouts will look for nearest
_layout
file, so no need for the trailing_
on the$userId.edit
route. It will simply nest underusers/_layout.tsx
Anyway, I'd appreciate any comments.
Beta Was this translation helpful? Give feedback.
All reactions