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

Function useRouter

packages/solid-router/src/useRouter.tsx:6–15  ·  view source on GitHub ↗
(opts?: {
  warn?: boolean
})

Source from the content-addressed store, hash-verified

4import type { AnyRouter, RegisteredRouter } from '@tanstack/router-core'
5
6export function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {
7 warn?: boolean
8}): TRouter {
9 const value = Solid.useContext(routerContext as any)
10 warning(
11 !((opts?.warn ?? true) && !value),
12 'useRouter must be used inside a <RouterProvider> component!',
13 )
14 return value as any
15}

Callers 15

TanStackRouterDevtoolsFunction · 0.90
ScriptsFunction · 0.90
useTagsFunction · 0.90
ScriptFunction · 0.90
RouteApiClass · 0.90
useLinkPropsFunction · 0.90
useRouterStateFunction · 0.90
LazyRouteClass · 0.90
TransitionerFunction · 0.90
MatchesFunction · 0.90
MatchesInnerFunction · 0.90

Calls

no outgoing calls

Tested by 2

RootComponentFunction · 0.72
HeaderFunction · 0.72