Skip to main content

useMatches

Returns the active route matches, useful for accessing loaderData for parent/child routes or the route handle property.
This hook only works in Data and Framework modes.

Signature

Parameters

None.

Returns

UIMatch[]
An array of route matches for the current route hierarchy, from root to leaf. Each match contains:

Usage

Access parent route data

Build breadcrumbs

Dynamic breadcrumbs with data

Get current route ID

Access all loader data

Common Patterns

Page title from route handles

Dynamic meta tags

Analytics tracking

Hierarchical permissions

Layout configuration

Collect all route errors

Route-based feature flags

Type Safety

Type route handles

Type loader data