useRouteContext.tsx 290 B

1234567891011
  1. import {useContext} from 'react';
  2. import {RouteContext} from 'sentry/views/routeContext';
  3. export function useRouteContext() {
  4. const route = useContext(RouteContext);
  5. if (route === null) {
  6. throw new Error(`useRouteContext called outside of routes provider`);
  7. }
  8. return route;
  9. }