Does React Router v6 automatically restore scroll position after loader‑driven navigation?
26K reputation · 10 Sept 2025, 03:26 UTC
Goal: Verify whether React Router v6 automatically restores scroll position after a navigation that triggers a loader function.
Constraints: The component offers a scrollRestoration prop that can be set to 'preventDefault' to let the application manage scroll, but the library does not provide a built‑in mechanism to restore scroll after loader‑driven navigation, leaving the behavior to developer‑implemented logic and ongoing discussion about a declarative component or integration with the browser's history.scrollRestoration API.
Does setting scrollRestoration='preventDefault' allow the app to control scroll position without interfering with the browser's default behavior? Is there a plan to integrate with history.scrollRestoration API for automatic scroll restoration after loader navigation?