| 38 | * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLocationHook |
| 39 | */ |
| 40 | export function useLocation< |
| 41 | TRouter extends AnyRouter = RegisteredRouter, |
| 42 | TSelected = unknown, |
| 43 | TStructuralSharing extends boolean = boolean, |
| 44 | >( |
| 45 | opts?: UseLocationBaseOptions<TRouter, TSelected, TStructuralSharing> & |
| 46 | StructuralSharingOption<TRouter, TSelected, TStructuralSharing>, |
| 47 | ): UseLocationResult<TRouter, TSelected> { |
| 48 | return useRouterState({ |
| 49 | select: (state: any) => |
| 50 | opts?.select ? opts.select(state.location) : state.location, |
| 51 | } as any) as UseLocationResult<TRouter, TSelected> |
| 52 | } |