State maintained internally by the router. During a navigation, all states reflect the the "old" location unless otherwise noted.

interface RouterState {
    actionData: null | RouteData;
    blockers: Map<string, Blocker>;
    errors: null | RouteData;
    fetchers: Map<string, Fetcher<any>>;
    historyAction: NavigationType;
    initialized: boolean;
    loaderData: RouteData;
    location: Location<any>;
    matches: AgnosticDataRouteMatch[];
    navigation: Navigation;
    preventScrollReset: boolean;
    restoreScrollPosition: null | number | false;
    revalidation: RevalidationState;
}

Properties

actionData: null | RouteData

Data from the action for the current matches

blockers: Map<string, Blocker>

Map of current blockers

errors: null | RouteData

Errors caught from loaders for the current matches

fetchers: Map<string, Fetcher<any>>

Map of current fetchers

historyAction: NavigationType

The action of the most recent navigation

initialized: boolean

Tracks whether we've completed our initial data load

loaderData: RouteData

Data from the loaders for the current matches

location: Location<any>

The current location reflected by the router

matches: AgnosticDataRouteMatch[]

The current set of route matches

navigation: Navigation

Tracks the state of the current navigation

preventScrollReset: boolean

Indicate whether this navigation should skip resetting the scroll position if we are unable to restore the scroll position

restoreScrollPosition: null | number | false

Current scroll position we should start at for a new view

  • number -> scroll position to restore to
  • false -> do not restore scroll at all (used during submissions)
  • null -> don't have a saved position, scroll to hash or top of page
revalidation: RevalidationState

Tracks any in-progress revalidations