ScrollRestoration: ScrollRestoration

ScrollRestorationR Documentation

ScrollRestoration

Description

https://api.reactrouter.com/v7/functions/react-router.ScrollRestoration.html

Usage

ScrollRestoration(...)

Arguments

...

Props to pass to element. Notable props: getKey (a JS function to compute the scroll key from the location) and storageKey (Character, custom sessionStorage key).

Details

Emulates the browser's scroll restoration on location changes after loaders have completed. Place once inside the root layout of a data router app. Requires a data router (createBrowserRouter, createHashRouter, etc.).

Value

A ScrollRestoration component.


reactRouter documentation built on May 10, 2026, 5:07 p.m.