12 lines
298 B
TypeScript
12 lines
298 B
TypeScript
import { useContext } from 'react';
|
|
|
|
import { AppContext, type AppContextValue } from './app-context';
|
|
|
|
export function useApp(): AppContextValue {
|
|
const context = useContext(AppContext);
|
|
if (!context) {
|
|
throw new Error('useApp must be used within an AppProvider');
|
|
}
|
|
return context;
|
|
}
|