useLocation.tsx 327 B

123456789101112
  1. import {Location, Query} from 'history';
  2. import {useRouteContext} from 'sentry/utils/useRouteContext';
  3. type DefaultQuery<T = string> = {
  4. [key: string]: T | T[] | null | undefined;
  5. };
  6. export function useLocation<Q extends Query = DefaultQuery>(): Location<Q> {
  7. const route = useRouteContext();
  8. return route.location;
  9. }