title: Call child method from parent class - React typescript
body: <p>How do I call a child method from parent class ? or to put it simply how to assign a ref to ReactElement? </p>
  
  <p>I've seen examples where ref is assigned to HTMLDivElement or HTMLInputElement, but not a ReactElement.</p>
  
  <pre><code>class Example extends React.Component&lt;Props, State&gt; {
    ...
    childRef = React.createRef&lt;React.ReactElement&gt;();
    ...
    next = () =&gt; {
      this.childRef.someFunction();
    }
  
    render() {
      &lt;Child ref={this.childRef}/&gt;
    }
  }
  </code></pre>
  
  <p>The above code gives me two errors:</p>
  
  <pre><code>Generic type 'ReactElement&lt;P&gt;' requires 1 type argument(s).
  Property 'someFunction' does not exist on type 'RefObject&lt;any&gt;'.
  </code></pre>