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