MCPcopy
hub / github.com/TanStack/router / MatchRoute

Function MatchRoute

packages/solid-router/src/Matches.tsx:180–205  ·  view source on GitHub ↗
(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>)

Source from the content-addressed store, hash-verified

178}
179
180export function MatchRoute<
181 TRouter extends AnyRouter = RegisteredRouter,
182 const TFrom extends string = string,
183 const TTo extends string | undefined = undefined,
184 const TMaskFrom extends string = TFrom,
185 const TMaskTo extends string = '',
186>(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any {
187 const status = useRouterState({
188 select: (s) => s.status,
189 })
190
191 return (
192 <Solid.Show when={status()} keyed>
193 {(_) => {
194 const matchRoute = useMatchRoute()
195 const params = matchRoute(props as any)() as boolean
196 const child = props.children
197 if (typeof child === 'function') {
198 return (child as any)(params)
199 }
200
201 return params ? child : null
202 }}
203 </Solid.Show>
204 )
205}
206
207export interface UseMatchesBaseOptions<TRouter extends AnyRouter, TSelected> {
208 select?: (matches: Array<MakeRouteMatchUnion<TRouter>>) => TSelected

Callers

nothing calls this directly

Calls 3

useRouterStateFunction · 0.90
statusFunction · 0.85
useMatchRouteFunction · 0.70

Tested by

no test coverage detected