teams.tsx 598 B

12345678910111213141516171819202122
  1. import {Fragment} from 'react';
  2. import useTeams from 'sentry/utils/useTeams';
  3. type RenderProps = ReturnType<typeof useTeams>;
  4. type Props = Parameters<typeof useTeams>[0] & {
  5. children: (props: RenderProps) => React.ReactNode;
  6. };
  7. /**
  8. * This is a utility component to leverage the useTeams hook to provide
  9. * a render props component which returns teams through a variety of inputs
  10. * such as a list of slugs or user teams.
  11. */
  12. function Teams({children, ...props}: Props) {
  13. const renderProps = useTeams(props);
  14. return <Fragment>{children(renderProps)}</Fragment>;
  15. }
  16. export default Teams;