0PricingLogin
React Academy · Lesson

Scroll Restoration & Not-Found Routes

Restore scroll when navigating back and show a friendly 404 for unknown routes; keep UX smooth on mobile.

Why restore & 404?

Goal: Keep navigation natural.

  • Scroll restore when going back
  • 404 page for unknown routes
  • Simple, lib-free demo

Concepts at a glance

  • Save scrollTop per route before leaving
  • On mount, read previous and scrollTo
  • Catch unmatched paths and show a clear not-found screen

All lessons in this course

  1. Nested Layouts, Loaders (Concept), Prefetching
  2. Auth Flows & Protected Routes
  3. Scroll Restoration & Not-Found Routes
← Back to React Academy