GoScrobble/web/node_modules/react-overlays/esm/safeFindDOMNode.js

8 lines
284 B
JavaScript
Raw Permalink Normal View History

2022-04-25 02:47:15 +00:00
import ReactDOM from 'react-dom';
export default function safeFindDOMNode(componentOrElement) {
if (componentOrElement && 'setState' in componentOrElement) {
return ReactDOM.findDOMNode(componentOrElement);
}
return componentOrElement != null ? componentOrElement : null;
}