React hook which gives a smooth scrolling function Sample in 2020

React hook which gives a smooth scrolling function Sample in 2020


tutorials -

use-smooth-scroll

React hook which gives a smooth scrolling function.

const Example = () => {
  const ref = React.useRef()
  const scrollTo = useSmoothScroll('x', ref)

  return (
    <>
      <button onClick={() => scrollTo(getRandomScrollTarget(ref.current))}>
        Click me
      </button>
      <Carousel innerRef={ref}>
        {range(100).map(i => (
          <Card key={i} />
        ))}
      </Carousel>
    </>
  )
}

GitHub

Trending On Tutorial Stuff

Our Sponsors

Top Applications in Tutorial Stuff

Top Experts In Tutorial Stuff