grafana/public/app/features/alerting/unified/hooks/useUnifiedAlertingSelector.ts
kay delaney 64bbb7a7ce
Chore: Update and enforce usage of typed react-redux hooks (#55349)
* Chore: Update and enforce usage of typed react-redux hooks
2022-09-19 10:49:35 +01:00

11 lines
379 B
TypeScript

import { useSelector } from 'app/types';
import { UnifiedAlertingState } from '../state/reducers';
export function useUnifiedAlertingSelector<TSelected = unknown>(
selector: (state: UnifiedAlertingState) => TSelected,
equalityFn?: (left: TSelected, right: TSelected) => boolean
): TSelected {
return useSelector((state) => selector(state.unifiedAlerting), equalityFn);
}