Package Exports
- @daveyplate/use-scroll-restoration
- @daveyplate/use-scroll-restoration/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@daveyplate/use-scroll-restoration) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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-restorationUsage
Simply call useScrollRestoration hook in a custom _app.js, parameters are all optional.
export function useScrollRestoration({ router = null, enabled = true, selector = null, delay = null } = {})