我正在Material-UI我的應(yīng)用程序中呈現(xiàn)以下組件: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只要滾動(dòng)經(jīng)過(guò)該特定ListItem.我想以最簡(jiǎn)單的方式使ListItem(來(lái)自 Material-UI)在handleSetActive觸發(fā)時(shí)啟用其懸停效果。我怎樣才能最好地做到這一點(diǎn)?
Material-UI:以編程方式觸發(fā)懸停效果
手掌心
2021-06-10 14:08:46