score:0

Accepted answer

a clean way is to fork third-party component and make it expose a ref.

one workaround is to extend third-party component:

class firstparty extends thirdparty {
  inputref = react.createref();

  render() {
    const inputreactel = super.render();
    return react.cloneelement(inputreactel, { ref: this.inputref });
  }
}

another workaround is to wrap it:

class firstparty extends component {
  componentdidmount() {
    this.inputdomel = reactdom.finddomnode(this);
  }

  render() {
    return <thirdparty {...this.props}/>;
  }
}

in case react 15 is in use, createref refs can be changed to legacy refs.

score:1

you can get a ref to your own div and write some code to find the node you need among its children.

since you have an id you can just window.document.getelementbyid(id) to access that node.


Related Query

More Query from same tag