context.tsx 578 B

1234567891011121314151617181920212223
  1. import {createContext} from 'react';
  2. import {LocationDescriptor} from 'history';
  3. type ChildTransaction = {
  4. eventSlug: string;
  5. id: string;
  6. 'project.name': string;
  7. transaction: string;
  8. };
  9. export type SpanEntryContextChildrenProps = {
  10. getViewChildTransactionTarget: (
  11. props: ChildTransaction
  12. ) => LocationDescriptor | undefined;
  13. };
  14. const SpanEntryContext = createContext<SpanEntryContextChildrenProps>({
  15. getViewChildTransactionTarget: () => undefined,
  16. });
  17. export const Provider = SpanEntryContext.Provider;
  18. export const Consumer = SpanEntryContext.Consumer;