buntal - components

useRouter

React hook that provides access to router state and navigation methods in Buntal applications.

Source

View source on GitHub

Type Definition

function useRouter(): {
  pathname: string
  search: string
  href: string
  protocol: string
  hostname: string
  hash: string
  push: (url: string) => void
  replace: (url: string) => void
  back: () => void
  reload: () => void
}

Properties

PropertyTypeRequiredDefaultDescription
pathnamestring-Current pathname of the URL
searchstring-Query string portion of the URL
hrefstring-Complete URL including protocol, host, and path
protocolstring-Protocol portion of the URL (http:, https:, etc.)
hostnamestring-Hostname portion of the URL
hashstring-Hash fragment portion of the URL

Methods

push

Navigate to a new URL and add it to the browser history

Parameters

ParameterTypeRequiredDefaultDescription
urlstring-URL to navigate to

Returns

void

replace

Navigate to a new URL and replace the current entry in browser history

Parameters

ParameterTypeRequiredDefaultDescription
urlstring-URL to navigate to

Returns

void

back

Navigate back to the previous page in browser history

Returns

void

reload

Reload the current page

Returns

void

Last modified: 2025-06-10

Content-Length: 0