The useChildMatches hook returns all of the child RouteMatch objects from the closest match down to the leaf-most match. It does not include the current match, which can be obtained using the useMatch hook.
Important
If the router has pending matches and they are showing their pending component fallbacks, router.state.pendingMatches will used instead of router.state.matches.
The useChildMatches hook accepts a single optional argument, an options object.
import { useChildMatches } from '@tanstack/react-router'
function Component() {
const childMatches = useChildMatches()
// ...
}
import { useChildMatches } from '@tanstack/react-router'
function Component() {
const childMatches = useChildMatches()
// ...
}
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.