replayCountContext.tsx 564 B

12345678910111213141516171819202122
  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. * });
  10. * return <ReplayCountContext.Provider value={counts}>{children}</ReplayCountContext.Provider>
  11. * ```
  12. *
  13. * And then read the data later:
  14. * ```
  15. * const count = useContext(ReplayCountContext)[groupId];
  16. * ```
  17. */
  18. const ReplayCountContext = createContext<ReturnType<typeof useReplaysCount>>({});
  19. export default ReplayCountContext;