react-spring-scroll-hook
v0.3.0
Published
Simple hook for creating smooth scroll list with arrows.
Downloads
17
Readme
react-spring-scroll-hook
Simple hook for creating smooth scroll list with arrows.
Install
yarn add react-spring-scroll-hook
Example
import useSpringScroll from 'react-spring-scroll-hook';
const {
ref,
left: handlePrevClick,
reset: handleWheel,
right: handleRightClick
} = useSpringScroll({ step: 100 });
return <div>
<img src={arrowPrevIcon} onClick={handlePrevClick} />
<div className="overflow" onWheel={handleWheel}>
{children}
</div>
<img src={arrowNextIcon} onClick={handleRightClick} />
</div>