🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

next-restore-scroll-position

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-restore-scroll-position

Restores scroll position when navigating back and forth in NextJS

1.0.9
latest
Source
npm
Version published
Weekly downloads
143
9.16%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

NextJS

FAQs

Package last updated on 27 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts