Best practice for route alias?
We have two routes that show the exact same content but their paths will differ, e.g.
/playlists/$playlistId
/library/$playlistId
Is there any best practice to have minimal boilerplate to make this happen? Right now I've defined a PlaylistView
component in routes/-shared/PlaylistView.tsx
which also exports a re-usable "route config" object for the loader.
I still have to define the component:
option for each route since I'm referencing the Route.useLoaderData()
and the actual route instance differs for the PlaylistView
Is there any better way to achieve this? Could I get type checking on my routeConfig
? I couldn't immediately find any type to use here, e.g. satisfies RouteConfig
2 Replies
correct-apricotOP•16mo ago
Or maybe I just found a great use-case for route masking? I did get this to work:
frail-apricot•16mo ago
we discussed this previously here
https://discord.com/channels/719702312431386674/1200515804622487592/1200515806073720924
but no solution is available yet, so your workarounds look feasible