import { createContext, useContext, type Dispatch } from "react"; import type { SoundAction, SoundState } from "../types/types"; type SoundContextType = { state: SoundState; dispatch: Dispatch; audioArmed: boolean; }; export const SoundContext = createContext( undefined ); export const useSoundContext = () => { const ctx = useContext(SoundContext); if (!ctx) throw new Error("useSoundContext must be used within "); return ctx; };