0.4.1 • Published 4 years ago

@jmdc-rehooks/use-restore-scroll-position v0.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

use-restore-scroll-position

Restore previous scroll position after reloading the page.

Usage

import useRestoreScrollPosition from '@jmdc-rehooks/use-restore-scroll-position

const Component = () => {
  const ref = React.useRef(null)
  useRestoreScrollPosition({ target: ref, scrollBehavior: 'auto' })

  return <div ref={ref}>Content</div>
}

Options

target: RefObject<HTMLElement>

RefObject of the target scroll container.

scrollBehavior: "smooth" | "auto"

Scroll behavior.

disable: boolean

Disable restoring scroll position.

0.4.1

4 years ago

0.4.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago