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

1.0.5 • Public • Published

NextJS Scroll Restoration

This package enables custom Scroll Restoration for NextJS Pages Router. You may supply a delay if you need to refetch data that isn't immediate, and you may specify a selector to use an element instead of the window for restoration.

Installation

npm install @daveyplate/use-scroll-restoration

Usage

Simply call useScrollRestoration hook in a custom _app.js, parameters are all optional.

export function useScrollRestoration({ router = null, enabled = true, selector = null, delay = null } = {})

Package Sidebar

Install

npm i @daveyplate/use-scroll-restoration

Weekly Downloads

4

Version

1.0.5

License

ISC

Unpacked Size

55.9 kB

Total Files

9

Last publish

Collaborators

  • leakeddave