This commit is contained in:
18
node_modules/react-dnd/dist/esm/hooks/useDrop/useDropTargetConnector.js
generated
vendored
Normal file
18
node_modules/react-dnd/dist/esm/hooks/useDrop/useDropTargetConnector.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useMemo } from 'react';
|
||||
import { TargetConnector } from '../../internals';
|
||||
import { useDragDropManager } from '../useDragDropManager';
|
||||
import { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect';
|
||||
export function useDropTargetConnector(options) {
|
||||
var manager = useDragDropManager();
|
||||
var connector = useMemo(function () {
|
||||
return new TargetConnector(manager.getBackend());
|
||||
}, [manager]);
|
||||
useIsomorphicLayoutEffect(function () {
|
||||
connector.dropTargetOptions = options || null;
|
||||
connector.reconnect();
|
||||
return function () {
|
||||
return connector.disconnectDropTarget();
|
||||
};
|
||||
}, [options]);
|
||||
return connector;
|
||||
}
|
||||
Reference in New Issue
Block a user