title: How to get the element from the ref in REACT
body: <p>I have a third-party library on my site that requires to send an element in a parameter like:</p>
  <pre><code>window.third-party(&quot;test&quot;,document.getElementById(&quot;test&quot;),...)
  </code></pre>
  <p>This is working fine in some of my websites, however, I have one built on REACT where is not working because when the call is done inside componentDidMount() it still does not exist.</p>
  <p>I've been trying using refs, however, I'm not able to get the DOM element and if I pass the ref like:</p>
  <pre><code>window.third-party(&quot;test&quot;,this.myElement.current,...)
  </code></pre>
  <p>it does not work :(</p>
  <hr />
  <p>This is how I define the ref:</p>
  <pre><code>&lt;Input
                      type=&quot;password&quot;
                      id=&quot;password-register&quot;
                      ref={this.myElement}
                    /&gt;
  </code></pre>
  <p>It does not work because this.myElement.current is not returning an element.</p>
  <p>How can I get the element inside <strong>componentDidMount()</strong> function?</p>
  <p>Many thanks</p>