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

Function useLinkProps

packages/solid-router/src/link.tsx:36–490  ·  view source on GitHub ↗
(
  options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,
)

Source from the content-addressed store, hash-verified

34const timeoutMap = new WeakMap<EventTarget, ReturnType<typeof setTimeout>>()
35
36export function useLinkProps<
37 TRouter extends AnyRouter = RegisteredRouter,
38 TFrom extends RoutePaths<TRouter['routeTree']> | string = string,
39 TTo extends string = '',
40 TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,
41 TMaskTo extends string = '',
42>(
43 options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,
44): Solid.ComponentProps<'a'> {
45 const router = useRouter()
46 const [isTransitioning, setIsTransitioning] = Solid.createSignal(false)
47 const shouldHydrateHash = !isServer && !!router.options.ssr
48 const hasHydrated = useHydrated()
49
50 let hasRenderFetched = false
51
52 const [local, rest] = Solid.splitProps(
53 Solid.mergeProps(
54 {
55 activeProps: () => ({ class: 'active' }),
56 inactiveProps: () => ({}),
57 },
58 options,
59 ),
60 [
61 'activeProps',
62 'inactiveProps',
63 'activeOptions',
64 'to',
65 'preload',
66 'preloadDelay',
67 'hashScrollIntoView',
68 'replace',
69 'startTransition',
70 'resetScroll',
71 'viewTransition',
72 'target',
73 'disabled',
74 'style',
75 'class',
76 'onClick',
77 'onBlur',
78 'onFocus',
79 'onMouseEnter',
80 'onMouseLeave',
81 'onMouseOver',
82 'onMouseOut',
83 'onTouchStart',
84 'ignoreBlocker',
85 ],
86 )
87
88 // const {
89 // // custom props
90 // activeProps = () => ({ class: 'active' }),
91 // inactiveProps = () => ({}),
92 // activeOptions,
93 // to,

Callers 3

RootComponentFunction · 0.90
RootComponentFunction · 0.90
LinkFunction · 0.70

Calls 15

useRouterFunction · 0.90
useHydratedFunction · 0.90
useRouterStateFunction · 0.90
isDangerousProtocolFunction · 0.90
exactPathTestFunction · 0.90
removeTrailingSlashFunction · 0.90
deepEqualFunction · 0.90
useIntersectionObserverFunction · 0.90
_optionsFunction · 0.85
resolvedStyleFunction · 0.85
resolvedClassNameFunction · 0.85
isActiveFunction · 0.85

Tested by

no test coverage detected