Skip to main content Link Menu Expand (external link) Document Search Copy Copied

useHash

A hook for getting the current hash of the page. Will cause re-renders when the hash changes.

API

export function useHash(options?: { stripHash?: boolean }): string

stripHash

If options.stripHash is true the hash will be returned without the literal “#” at the beginning. If you need the “#” set options.stripHash to false. default = true