Skip to content

Instantly share code, notes, and snippets.

@shotgundebugging
Created February 20, 2026 15:23
Show Gist options
  • Select an option

  • Save shotgundebugging/4f4bc1b628d386ec4b71a14060e1db05 to your computer and use it in GitHub Desktop.

Select an option

Save shotgundebugging/4f4bc1b628d386ec4b71a14060e1db05 to your computer and use it in GitHub Desktop.
Route vs context state
- Route state (location.state) is a one-time payload passed during navigation (navigate(..., { state }) or <Link state={...}>).
- It does not auto-refresh.
- It can be stale after backend changes.
- It may be missing on direct URL loads/reloads.
- Context state (UserAdminContext) is shared app state provided by UserLinks.
- It is loaded/refreshed from API (fetchUser(userId)).
- It updates over time and is the source of truth for current user data in that section.
- It is consistent across nested admin user pages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment