Memoize dispatch callback in error dialog

This commit is contained in:
Stefano Brilli 2020-09-03 08:46:33 +02:00
parent 1b79416d2a
commit 51812af06f
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import React from 'react';
import React, { useCallback } from 'react';
import { useDispatch } from 'react-redux';
import { useShallowEqualSelector } from '../utils';
@ -25,9 +25,9 @@ export const ErrorDialog = (props: {}) => {
let { visible, error } = useShallowEqualSelector(state => state.errorDialog);
const handleClose = () => {
const handleClose = useCallback(() => {
dispatch(errorDialogActions.setVisible(false));
};
}, [dispatch]);
return (
<Dialog