我正在Material-UI我的应用程序中呈现以下组件:
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}
/>
)
它正在使用react-scroll包,onSetActive只要滚动经过该特定ListItem.
我想以最简单的方式使ListItem(来自 Material-UI)在handleSetActive触发时启用其悬停效果。
我怎样才能最好地做到这一点?
相关分类