From 6294f5fa3384f82f51631e43685bba0e49abab4f Mon Sep 17 00:00:00 2001 From: codetorso Date: Sat, 29 Jun 2024 20:34:48 +0530 Subject: fix typescript errors --- apps/web/lib/context.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 apps/web/lib/context.ts (limited to 'apps/web/lib/context.ts') diff --git a/apps/web/lib/context.ts b/apps/web/lib/context.ts new file mode 100644 index 00000000..4e6ecd1c --- /dev/null +++ b/apps/web/lib/context.ts @@ -0,0 +1,18 @@ +import { createContext, useContext } from 'react'; + +export interface DragContextType { + isDraggingOver: boolean; + setIsDraggingOver: React.Dispatch>; +} + +const DragContext = createContext(undefined); + +export const useDragContext = () => { + const context = useContext(DragContext); + if (context === undefined) { + throw new Error('useAppContext must be used within an AppProvider'); + } + return context; +}; + +export default DragContext; \ No newline at end of file -- cgit v1.2.3