Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-node-resolver

jossmac116.3kMIT2.0.1TypeScript support: definitely-typed

A generic technique for resolving the DOM node of any react component.

react, node, node-resolver, dom

readme

React Node Resolver

A generic technique for resolving the DOM node of any react component.

Build Status

Install

yarn add react-node-resolver

Use

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>
    );
  }
}

Props

Property Type Description
children Element A single react Component
innerRef ElementRef Callback ref ref => this.node = ref