RouterState
react-router

RouterState interface

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

Properties

actionData

Type: null | RouteData

Data from the action for the current matches

blockers

Type: Map<string, Blocker>

Map of current blockers

errors

Type: null | RouteData

Errors caught from loaders for the current matches

fetchers

Type: Map<string, Fetcher<any>>

Map of current fetchers

historyAction

Type: Action

The action of the most recent navigation

initialized

Type: boolean

Tracks whether we've completed our initial data load

loaderData

Type: RouteData

Data from the loaders for the current matches

location

Type: Location<any>

The current location reflected by the router

matches

Type: AgnosticDataRouteMatch[]

The current set of route matches

Type: Navigation

Tracks the state of the current navigation

preventScrollReset

Type: boolean

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

restoreScrollPosition

Type: 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

Type: RevalidationState

Tracks any in-progress revalidations

Docs and examples CC 4.0