How to match location with fullpath in beforeLoad method
Here https://stackblitz.com/edit/tanstack-router-wryvvkja?file=src%2Froutes%2F_appLayout.tsx
I am currently in a situation where i need to match a pathname (i.e "/patients/agnes_smithson-132/diagnostic-history") with "/patients/$patient_slug/diagnostic-history". Please all these are dynamic as it is in the above code.
Using router.routeByPath, i get all routes object, is it possible to use location to match the current route from the routes object.
Chigoziem Nwaiwu
StackBlitz
Router Quickstart File Based Example (forked) - StackBlitz
Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz
3 Replies
extended-salmonOP•5mo ago
The major thing i need here is how best to access the current route RouteOptions
Thanks guys ... router.getMatchedRoutes(location)?.foundRoute did the magic.
foreign-sapphire•5mo ago
thats not necessary though
you get the matches in there already
extended-salmonOP•5mo ago
woooooow ... Thanks