Memoize dispatch callback in error dialog
This commit is contained in:
parent
1b79416d2a
commit
51812af06f
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue