%PDF- %PDF-
Direktori : /var/www/html/node_modules/react-popper/lib/esm/ |
Current File : /var/www/html/node_modules/react-popper/lib/esm/Manager.js |
import * as React from 'react'; export var ManagerReferenceNodeContext = React.createContext(); export var ManagerReferenceNodeSetterContext = React.createContext(); export function Manager(_ref) { var children = _ref.children; var _React$useState = React.useState(null), referenceNode = _React$useState[0], setReferenceNode = _React$useState[1]; var hasUnmounted = React.useRef(false); React.useEffect(function () { return function () { hasUnmounted.current = true; }; }, []); var handleSetReferenceNode = React.useCallback(function (node) { if (!hasUnmounted.current) { setReferenceNode(node); } }, []); return /*#__PURE__*/React.createElement(ManagerReferenceNodeContext.Provider, { value: referenceNode }, /*#__PURE__*/React.createElement(ManagerReferenceNodeSetterContext.Provider, { value: handleSetReferenceNode }, children)); }