wouter icon indicating copy to clipboard operation
wouter copied to clipboard

[feature request] access hash using default `useLocation` hook

Open purplepenguin2 opened this issue 9 months ago • 1 comments

I'm using the default useLocation hook and not hash based routing, but I have a few use cases where I use the hash in a URL as a potential hint for rendering something. For example, a form component might use #edit when editing mode is enabled, etc. Is there a better option for accessing the hash versus pulling down both useLocation and useHashLocation hooks?

It also doesn't seem like the useHashLocation hook's navigate function allows removing the hash, so I still need to use the useLocation hook's navigate function regardless.

Is there an easier way to handle this, or is the use case not one that's really supported at the moment?

purplepenguin2 avatar Mar 17 '25 22:03 purplepenguin2

Have you tried transforming href using hrefs?

anonimusprogramus avatar Aug 27 '25 14:08 anonimusprogramus