T
TanStack5mo ago
stormy-gold

is there anything wrong with wrapping `getRouteApi(...).use<whatever>` in try/catch

i want to be able to generically grab stuff from the url, and the nicest way feels like getting this data from the relevant Route params in my case if you call useParams on a non active route, this throws. any issue with effectively turning this into a result type of <RouteParams, Error>? perf issues, or some footgun i've not considered?
2 Replies
conscious-sapphire
conscious-sapphire5mo ago
You can pass shouldThrow: false to useParams so it won’t throw on non-active routes. It’s powered by useMatch under the hood.
stormy-gold
stormy-goldOP5mo ago
Awesome, thank you

Did you find this page helpful?