$ npm install react-node-resolver
A generic technique for resolving the DOM node of any react component.
yarn add react-node-resolver
import NodeResolver from 'react-node-resolver';
class ObfuscatedComponent extends Component {
render() {
return <div id="inaccessible-node" />;
}
}
class GroovyThing extends Component {
getNode = (ref) => {
console.log(ref); // <div id="inaccessible-node" />
}
render () {
return (
<NodeResolver innerRef={this.getNode}>
<ObfuscatedComponent />
</NodeResolver>
);
}
}
Property | Type | Description |
---|---|---|
children |
Element |
A single react Component |
innerRef |
ElementRef |
Callback ref ref => this.node = ref |
© 2010 - cnpmjs.org x YWFE | Home | YWFE