aboutsummaryrefslogtreecommitdiff
path: root/apps/web/lib/context.ts
blob: 6c6bfa1b2f97378ecc7bc63d04a568237e347646 (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;