1.0.9 • Published 1 year ago

next-restore-scroll-position v1.0.9

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Restore scroll position in NextJS

Restores scroll position when navigating back and forth in NextJS.

Installation

yarn add next-restore-scroll-position
npm i next-restore-scroll-position

Usage

import { useScrollRestoration } from 'next-restore-scroll-position';

function App() { // This needs to be NextJS App Component
    const router = useRouter();
    useScrollRestoration(router);
}

You can also disable the scroll restoration by passing enabled property

import { useScrollRestoration } from 'next-restore-scroll-position';

function App() { // This needs to be NextJS App Component
    const router = useRouter();
    useScrollRestoration(router, {enabled: false});
}

Peer dependencies

  • React 16 or up
  • Next 13
1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago