Closed vangelov closed 5 months ago
The +
suffix is hybrid routes and is used for nesting.
Whereas folders without the +
suffix is for colocation.
Hybrid routes use the following transformations:
parent+/_layout.tsx
=> someroute.tsx
parent+/child.tsx
=> parent.child.tsx
parent+/child+/another.tsx
=> parent.child.another.tsx
parent+/_.child.tsx
=> parent_.child.tsx
(when you don't want child to use parent layout)_index.tsx
(v2 convention), although RFR does support index.tsx
.
parent+
├── _layout.tsx => parent.tsx
└── child+
└──_index.tsx => parent.child._index.tsx
and this (without +
):
In Remix v2
routing and remix-flat-routes
you can use a folder (without +
) for colocation. The folder name is your route name, and the route module is the file named: route.tsx
.
Only the leaf route should have a naked folder. Instead of parent/child/route.tsx
it should be parent.child/route.tsx
parent
├── _layout.tsx => parent.tsx
└── child => technically invalid (folder should only be on leaf route)
└──index.tsx
parent.child => this is correct
├── route.tsx => v2 convention uses `route.tsx` for route module
remix-flat-routes allows index, page, route, layout or anything starting with `_`
Thank you for the detailed explanation.
I read the docs several times and did some tests but I still can't understand the difference between this:
and this (without
+
):