Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const scrollStep = () => {
const container = getTarget(refContainer)
const {scrollTop} = container
const {current: intervalId} = intervalRef
if (scrollTop === 0) clearInterval(intervalId)
if (scrollTop) container.scrollTop = scrollTop - scrollSteps
}
useEffect(() => {
const container = getTarget(refContainer)
const {scrollHeight, clientHeight} = container
const halfHeight = Math.floor((scrollHeight - clientHeight) / 2)
const handleScroll = () => {
const {scrollTop} = container
if (scrollTop > halfHeight) {
if (!show) {
setShow(true)
}
} else {
if (show) {
setShow(false)
setHover(false)
}
}
}