本页还没有译文
本页 12 段还没译成简体中文,下面显示的是英文原文。useChildMatches hook
还没翻译译自英文(tanstack.com)本页 12 段都还没译
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.
The result is derived from the router's current match presentation. It can include still-loading descendants and descendants below the current render boundary.
useChildMatches options
The useChildMatches hook accepts a single optional argument, an options object.
opts.select option
- Optional
(matches: RouteMatch[]) => TSelected- If supplied, this function will be called with the route matches and the return value will be returned from
useChildMatches. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks.
opts.structuralSharing option
- Type:
boolean - Optional
- Configures whether structural sharing is enabled for the value returned by
select. - See the Render Optimizations guide for more information.
useChildMatches returns
- If a
selectfunction is provided, the return value of theselectfunction. - If no
selectfunction is provided, an array ofRouteMatchobjects.
Examples
import { useChildMatches } from '@tanstack/react-router'
function Component() {
const childMatches = useChildMatches()
// ...
}AI 翻译查看英文原文