The useParentMatches hook returns all of the parent RouteMatch objects from the root down to the immediate parent of the current match in context. It does not include the current match, which can be obtained using the useMatch hook.
The result is derived from the router's current match presentation. During a navigation that may still be the previous presentation; after pending UI is published it is the destination's complete structurally matched lane.
The useParentMatches hook accepts an optional options object.
import { useParentMatches } from '@tanstack/react-router'
function Component() {
const parentMatches = useParentMatches()
// ^ [RouteMatch, RouteMatch, ...]
}