feat: Add tab navigation to hotel page

This commit is contained in:
Chuma McPhoy
2024-07-18 00:40:49 +02:00
parent 9b0ee16282
commit ebe79c43e0
14 changed files with 145 additions and 20 deletions

22
hooks/useHash.tsx Normal file
View File

@@ -0,0 +1,22 @@
"use client"
import { useParams } from "next/navigation"
import { useEffect, useState } from "react"
const getHash = () =>
typeof window !== "undefined" ? window.location.hash : undefined
const useHash = () => {
const [isClient, setIsClient] = useState(false)
const [hash, setHash] = useState(getHash())
const params = useParams()
useEffect(() => {
setIsClient(true)
setHash(getHash())
}, [params])
return isClient ? hash : null
}
export default useHash