14 lines
360 B
TypeScript
14 lines
360 B
TypeScript
import { createContext, useContext } from "react"
|
|
|
|
import type { RoomContextValue } from "@/types/contexts/details/room"
|
|
|
|
export const RoomContext = createContext<RoomContextValue | null>(null)
|
|
|
|
export function useRoomContext() {
|
|
const ctx = useContext(RoomContext)
|
|
if (!ctx) {
|
|
throw new Error("Missing context value [RoomContext]")
|
|
}
|
|
return ctx
|
|
}
|