Match
The first matching Route and the decoded parameter record.
Compatibility
ReactAvailable in this renderer's browser integration.
React SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.
PreactAvailable in this renderer's browser integration.
Preact SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.
Import from @kasperrt/smolter/react @kasperrt/smolter/preact
Signature
interface Match {
route: Route;
params: Params;
}Usage
The first matching Route and the decoded parameter record. matchRoutes returns undefined when no pattern matches. Match does not contain loader data and does not execute handlers.
const match = matchRoutes(routes, "/tasks/1");
const id = match?.params.id;Fields
route
route: Route;params
params: Params;