| 16 | ) => Accessor<UseRouteContextResult<TRouter, TFrom, true, TSelected>> |
| 17 | |
| 18 | export function useRouteContext< |
| 19 | TRouter extends AnyRouter = RegisteredRouter, |
| 20 | const TFrom extends string | undefined = undefined, |
| 21 | TStrict extends boolean = true, |
| 22 | TSelected = unknown, |
| 23 | >( |
| 24 | opts: UseRouteContextOptions<TRouter, TFrom, TStrict, TSelected>, |
| 25 | ): Accessor<UseRouteContextResult<TRouter, TFrom, TStrict, TSelected>> { |
| 26 | return useMatch({ |
| 27 | ...(opts as any), |
| 28 | select: (match) => |
| 29 | opts.select ? opts.select(match.context) : match.context, |
| 30 | }) as any |
| 31 | } |