Skip to content

Commit

Permalink
Remove unnecessary useEventCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Jun 15, 2021
1 parent c80a4b1 commit a60685e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/material-ui/src/ButtonBase/Ripple.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import useEventCallback from '../utils/useEventCallback';

/**
* @ignore - internal component.
Expand All @@ -15,7 +14,7 @@ function Ripple(props) {
rippleY,
rippleSize,
in: inProp,
onExited = () => {},
onExited,
timeout,
} = props;
const [leaving, setLeaving] = React.useState(false);
Expand All @@ -36,20 +35,19 @@ function Ripple(props) {
[classes.childPulsate]: pulsate,
});

const handleExited = useEventCallback(onExited);
if (!inProp && !leaving) {
setLeaving(true);
}
React.useEffect(() => {
if (!inProp) {
if (!inProp && onExited != null) {
// react-transition-group#onExited
const timeoutId = setTimeout(handleExited, timeout);
const timeoutId = setTimeout(onExited, timeout);
return () => {
clearTimeout(timeoutId);
};
}
return undefined;
}, [handleExited, inProp, timeout]);
}, [onExited, inProp, timeout]);

return (
<span className={rippleClassName} style={rippleStyles}>
Expand Down

0 comments on commit a60685e

Please sign in to comment.