Skip to content

Commit

Permalink
Update last leftover from React Redux 8 migration
Browse files Browse the repository at this point in the history
Use the specialized `useAppDispatch()` and `useAppSelector()` hooks
everywhere.

Follow-up to  #64
  • Loading branch information
mgrabovsky committed Jun 8, 2023
1 parent 5687286 commit 5e36480
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/components/PageCommon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import _ from 'lodash';
import * as React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useSearchParams } from 'react-router-dom';
import {
Alert,
Expand All @@ -33,24 +32,20 @@ import {
} from '@patternfly/react-core';

import { config } from '../config';
import { useTitle } from '../hooks';
import { RootStateType } from '../slices';
import { useAppDispatch, useAppSelector, useTitle } from '../hooks';
import { popAlert } from '../actions';
import { IStateAlerts } from '../actions/types';
import { DashboardPageHeader } from './PageHeader';

type PageCommonProps = React.PropsWithChildren<React.ReactNode> & {
title?: string;
};

export function ToastAlertGroup() {
const dispatch = useDispatch();
const dispatch = useAppDispatch();
const onClick = (key: number) => {
dispatch(popAlert(key));
};
const { alerts } = useSelector<RootStateType, IStateAlerts>(
(state) => state.alerts,
);
const { alerts } = useAppSelector((state) => state.alerts);
return (
<AlertGroup isToast>
{_.map(alerts, ({ key, title, variant }) => (
Expand Down

0 comments on commit 5e36480

Please sign in to comment.