19 lines
No EOL
443 B
JavaScript
19 lines
No EOL
443 B
JavaScript
/**
|
|
* Provides a standard way to access a DOM node across all versions of
|
|
* React.
|
|
*/
|
|
|
|
import { reactPaths } from './react-loader';
|
|
const React = window.React;
|
|
const ReactDOM = window.ReactDOM;
|
|
export function findDOMNode(target) {
|
|
const {
|
|
needsReactDOM
|
|
} = reactPaths();
|
|
if (needsReactDOM) {
|
|
return target |> ReactDOM.findDOMNode(%);
|
|
} else {
|
|
// eslint-disable-next-line
|
|
return target |> React.findDOMNode(%);
|
|
}
|
|
} |