I am rendering the following Material-UI component in my app:
const handleSetActive = _spyOn => {
linkEl.current.focus();
};
const linkEl = useRef(null);
return (
<ListItem
button
component={SmoothScrollLink}
to={cutTo}
spy
smooth
offset={(phone ? -theme.mixins.toolbar.minHeightPhone : -theme.mixins.toolbar.minHeightDesktop) - 20}
duration={500}
onSetActive={handleSetActive}
// className={classNames(spyOn === cutTo && classes.hover)}
ref={linkEl}
{...other}
/>
)
It is using the react-scroll package which fires onSetActive whenever one scrolls past that particular ListItem.
I would like, in the simplest way possible, to make ListItem (from Material-UI) enable its hover effect when handleSetActive fires.
How would I best accomplish that?