mkstackwithwelshman/src/hooks/useAppContext.ts

14 lines
455 B
TypeScript
Raw Normal View History

2025-06-04 10:04:39 -05:00
import { useContext } from "react";
import { AppContext, type AppContextType } from "@/contexts/AppContext";
/**
* Hook to access and update application configuration
* @returns Application context with config and update methods
*/
export function useAppContext(): AppContextType {
2025-06-04 10:04:39 -05:00
const context = useContext(AppContext);
if (context === undefined) {
throw new Error('useAppContext must be used within an AppProvider');
2025-06-04 10:04:39 -05:00
}
return context;
}