useUnifiedAlertingSelector.ts 434 B

123456789101112
  1. import { useSelector } from 'react-redux';
  2. import { StoreState } from 'app/types';
  3. import { UnifiedAlertingState } from '../state/reducers';
  4. export function useUnifiedAlertingSelector<TSelected = unknown>(
  5. selector: (state: UnifiedAlertingState) => TSelected,
  6. equalityFn?: (left: TSelected, right: TSelected) => boolean
  7. ): TSelected {
  8. return useSelector((state: StoreState) => selector(state.unifiedAlerting), equalityFn);
  9. }