---
title: Scroll Restoration
toc: false
order: 1
---

# Scroll Restoration

This example demonstrates the basic usage of the `<ScrollRestoration>` component, including:

- Restoring scroll position via `location.key`
- Restoring scroll position via `location.pathname`
- Preventing scroll resetting via `<Link>`

## Preview

Open this example on [StackBlitz](https://stackblitz.com):

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/remix-run/react-router/tree/main/examples/scroll-restoration?file=src/App.tsx)
