useHash is a custom React hook that simplifies working with URL hash values in Next.js applications. It allows you to easily retrieve and update the hash value, while ensuring proper hydration and avoiding mismatches between server-rendered and client-rendered HTML. The hook provides a seamless way to handle hash changes and keep your component in sync with the URL hash value.
Name | Type | Description |
---|---|---|
hash | string | null | The current hash value from the URL, without the # prefix. |
addHash | (hash: string) => void | Function to update the hash value in the URL. |
Key Features