Themes

Router/Types/Router
Router
Name
Description
Type
history

Access the router history.

RouterHistory
location

The current location.

LocationSegments
fillPath

Fill a path string with passed parameters.

(path: string parameters: Record<string, string> ) => string

RouterHistory

Name
Description
Type
action

The previously applied action. ("PUSH", "POP", "REPLACE")

string
block
(prompt: string | Prompt ) => () => void
createHref
(location: LocationSegments ) => string
go
(delta: number ) => void
goBack
() => void
goForward
() => void
length

Returns an Integer representing the number of elements in the session history, including the currently loaded page.

number
listen
(listener: Listener ) => () => void
location

The current location.

LocationSegments
push
(path: string | LocationSegments state: any updateScroll: boolean ) => void
replace
(path: string | LocationSegments state: any updateScroll: boolean ) => void
win

The window that this history is attached to.

Window

Prompt

Prompt = (location: LocationSegments action: string ) => string

LocationSegments

Name
Description
Type
hash

The current hash.

string
key

The key of the location.

string
pathname

The path from root.

string
query

The contents of the search params.

Record<string, any>
scrollPosition

A tuple of [x, y] scroll position.

[number, number]
search

The current search string.

string
state

Any state that has been attached to the current location.

any

Listener

Listener = (location: LocationSegments action: string ) => void