Auth Flows & Protected Routes
Build a simple auth flow: login state, protecting routes, capturing the intended path, and basic role checks.
Why protected routes
Goal: Protect pages that need a signed-in user.
- Track auth state
- Guard routes
- Remember intended path
Core concepts
- Auth store: user or null
- Guard: if no user → go login
- Post-login: navigate to saved target
All lessons in this course
- Nested Layouts, Loaders (Concept), Prefetching
- Auth Flows & Protected Routes
- Scroll Restoration & Not-Found Routes