UNPKG

569 BJavaScriptView Raw
1'use strict';
2
3var _require = require('react-dnd'),
4 DragDropContext = _require.DragDropContext;
5
6var HTML5Backend = require('react-dnd-html5-backend').default;
7
8var context = void 0;
9
10/**
11 * Wrap a component in a singleton drag drop context.
12 *
13 * @param {React.Component} component - The component.
14 *
15 * @returns {React.Component} The wrapped component.
16 */
17var WithDragDropContext = function WithDragDropContext(component) {
18 if (!context) {
19 context = DragDropContext(HTML5Backend);
20 }
21 return context(component);
22};
23
24module.exports = WithDragDropContext;
\No newline at end of file