@mirawision/reactive-hooks
Version:
A comprehensive collection of 50+ React hooks for state management, UI interactions, device APIs, async operations, drag & drop, audio/speech, and more. Full TypeScript support with SSR safety.
22 lines (21 loc) • 623 B
TypeScript
import { RefObject } from 'react';
export interface DragState {
dragging: boolean;
}
/**
* A hook that provides drag functionality for an element.
* @param ref React ref object for the draggable element
* @param data Data to transfer during drag operation
* @returns Object containing drag state
*
* @example
* const ref = useRef(null);
* const { dragging } = useDrag(ref, { id: 'item-1', type: 'task' });
*
* return (
* <div ref={ref} style={{ opacity: dragging ? 0.5 : 1 }}>
* Draggable Item
* </div>
* );
*/
export declare function useDrag(ref: RefObject<HTMLElement>, data?: any): DragState;