@getapper/use-smooth-scroll
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

use-smooth-scroll

React hook to smooth scroll to an element in the web page

NPM JavaScript Style Guide

Install

npm install --save @getapper/use-smooth-scroll

Usage

import * as React from 'react'

import useSmoothScroll from '@getapper/use-smooth-scroll'

const Example = () => {
  const divRef = useRef(null);
  const cb = useSmoothScroll(divRef);
  return (
    <div>
      <div>
        <button onClick={cb}>
           Scroll
        </button>
      </div>
      <div ref={divRef}></div>
    </div>
  )
}

License

MIT © getapper


This hook is created using create-react-hook.

Readme

Keywords

none

Package Sidebar

Install

npm i @getapper/use-smooth-scroll

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

5.34 kB

Total Files

8

Last publish

Collaborators

  • antoniogiordano