replayCountContext.tsx 578 B

1234567891011121314151617181920212223
  1. import {createContext} from 'react';
  2. import type useReplaysCount from 'sentry/components/replays/useReplaysCount';
  3. /**
  4. * To set things up:
  5. * ```
  6. * const counts = useReplaysCount({
  7. * groupIds: [id],
  8. * organization,
  9. * project,
  10. * });
  11. * return <ReplayCountContext.Provider value={counts}>{children}</ReplayCountContext.Provider>
  12. * ```
  13. *
  14. * And then read the data later:
  15. * ```
  16. * const count = useContext(ReplayCountContext)[groupId];
  17. * ```
  18. */
  19. const ReplayCountContext = createContext<ReturnType<typeof useReplaysCount>>({});
  20. export default ReplayCountContext;