aboutsummaryrefslogtreecommitdiff
path: root/apps/web/lib/context.ts
blob: 840c0d31de4820587c5a5d91c3969bce4a070b32 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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;