diff options
| author | codetorso <[email protected]> | 2024-06-29 20:34:48 +0530 |
|---|---|---|
| committer | codetorso <[email protected]> | 2024-06-29 20:34:48 +0530 |
| commit | 6294f5fa3384f82f51631e43685bba0e49abab4f (patch) | |
| tree | 7382bfd7aee339f5e444f69cbb60bfe9bed580d6 /apps/web/lib/context.ts | |
| parent | user canvas (2/2) (diff) | |
| download | supermemory-6294f5fa3384f82f51631e43685bba0e49abab4f.tar.xz supermemory-6294f5fa3384f82f51631e43685bba0e49abab4f.zip | |
fix typescript errors
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..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<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;
\ No newline at end of file |