@guruhotel/aura-hooks
Version:
🪝 Hooks library designed by the Guruhotel team for Aura UI
1 lines • 295 B
JavaScript
import{useState as o,useEffect as n}from"react";import{useWindowEvent as t}from"../use-window-event/use-window-event";export function useHash(){const[e,i]=o(""),a=o=>{window.location.hash=o,i(o)};return t("hashchange",(()=>{i(window.location.hash)})),n((()=>{a(window.location.hash)}),[]),[e,a]}