diff options
Diffstat (limited to 'apps/web/lib/context.ts')
| -rw-r--r-- | apps/web/lib/context.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/web/lib/context.ts b/apps/web/lib/context.ts new file mode 100644 index 00000000..840c0d31 --- /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<React.SetStateAction<boolean>>; +} + +const DragContext = createContext<DragContextType | undefined>(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; |