diff --git a/packages/react-router/src/Matches.tsx b/packages/react-router/src/Matches.tsx index 0d1855de783..0d64831d944 100644 --- a/packages/react-router/src/Matches.tsx +++ b/packages/react-router/src/Matches.tsx @@ -123,6 +123,18 @@ export type UseMatchRouteOptions< MaskOptions & MatchRouteOptions +/** + * Create a matcher function for testing locations against route definitions. + * + * The returned function accepts standard navigation options (`to`, `params`, + * `search`, etc.) and returns either `false` (no match) or the matched params + * object when the route matches the current or pending location. + * + * Useful for conditional rendering and active UI states. + * + * @returns A `matchRoute(options)` function that returns `false` or params. + * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchRouteHook + */ export function useMatchRoute() { const router = useRouter() @@ -231,6 +243,15 @@ export function useMatches< } as any) as UseMatchesResult } +/** + * Read the full array of active route matches or select a derived subset. + * + * Useful for debugging, breadcrumbs, or aggregating metadata across matches. + * + * @returns The array of matches (or the selected value). + * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchesHook + */ + /** * Read the full array of active route matches or select a derived subset. * diff --git a/packages/react-router/src/useNavigate.tsx b/packages/react-router/src/useNavigate.tsx index 48b1d1e6269..85e13b2c7a8 100644 --- a/packages/react-router/src/useNavigate.tsx +++ b/packages/react-router/src/useNavigate.tsx @@ -8,6 +8,20 @@ import type { UseNavigateResult, } from '@tanstack/router-core' +/** + * Imperative navigation hook. + * + * Returns a stable `navigate(options)` function to change the current location + * programmatically. Prefer the `Link` component for user-initiated navigation, + * and use this hook from effects, callbacks, or handlers where imperative + * navigation is required. + * + * Options: + * - `from`: Optional route base used to resolve relative `to` paths. + * + * @returns A function that accepts `NavigateOptions`. + * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useNavigateHook + */ export function useNavigate< TRouter extends AnyRouter = RegisteredRouter, TDefaultFrom extends string = string,