useHash() — supabase Function Reference
Architecture documentation for the useHash() function in useHash.ts from the supabase codebase.
Entity Profile
Relationship Graph
Source Code
apps/docs/hooks/useHash.ts lines 3–27
const useHash = () => {
const [hash, setHash] = useState(() =>
typeof window !== 'undefined' ? window.location.hash.split('#')[1] : undefined
)
const hashChangeHandler = useCallback(() => {
setHash(window.location.hash.split('#')[1])
}, [])
useEffect(() => {
window.addEventListener('hashchange', hashChangeHandler)
return () => {
window.removeEventListener('hashchange', hashChangeHandler)
}
}, [hashChangeHandler])
const updateHash = useCallback(
(newHash) => {
if (newHash !== hash) window.location.hash = newHash
},
[hash]
)
return [hash, updateHash] as const
}
Domain
Subdomains
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free