solid-primitives
solid-primitives copied to clipboard
useLocationHash
Describe The Problem To Be Solved
reactively use location hash
Suggest A Solution
const locationHash = useLocationHash();
createEffect(() => {
console.log(locationHash()); // => '#' + string
});
https://developer.mozilla.org/en-US/docs/Web/API/Window/hashchange_event
I was working on a url package long time ago, but dropped it because I didn't know what I was doing and solid-router provides similar functionality. But maybe it could be revived with a smaller, more focus scope.
This it createLocationState which was kinda doing that: https://github.com/solidjs-community/solid-primitives/blob/url/packages/url/src/location.ts#L113