Adding dependencies the hook

Signed-off-by: Elizabeth Stranack <elstranack@expediagroup.com>
This commit is contained in:
Elizabeth Stranack
2022-01-25 12:40:26 -08:00
parent d249d6742d
commit 957d7210e6
@@ -132,11 +132,11 @@ export function Gauge(props: GaugeProps) {
const asActual = max !== 100 ? Math.round(value) : asPercentage;
const [isHovering, setIsHovering] = useState(false);
const handleMouseOver = () => setIsHovering(true);
const handleMouseOut = () => setIsHovering(false);
useEffect(() => {
const node = hoverRef;
const handleMouseOver = () => setIsHovering(true);
const handleMouseOut = () => setIsHovering(false);
if (node && description) {
node.addEventListener('mouseenter', handleMouseOver);
node.addEventListener('mouseleave', handleMouseOut);
@@ -149,7 +149,7 @@ export function Gauge(props: GaugeProps) {
return () => {
setIsHovering(false);
};
});
}, [description, hoverRef]);
return (
<div ref={setHoverRef} className={classes.root}>