Yura Chim
Yura Chim

Reputation: 13

Is any solution for remix dynamic route name divided by "-"?

I need implement route with name: /someroute-1, /someroute-2 ... and so on. With dynamic part after "-" For example: app/routes/someroute-$id

p.s: NOT app/routes/someroute/$id

I tried app/routes/someroute-$id, it is doesn't work

Upvotes: 0

Views: 82

Answers (1)

Kiliman
Kiliman

Reputation: 20322

No. In React Router 6 (and Remix), dynamic params must be the entire URL segment (the part between the /).

You have to do something like app/routes/$someroute, and in your loader, parse params.someroute to extract the id.

Upvotes: 0

Related Questions