supermemory/apps/web/lib/context.ts
2024-07-16 19:26:47 -05:00

18 lines
492 B
TypeScript

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;