title: React createPortal with useRef does not work
body: <pre><code>  const ref = useRef(null);
  
    return (
      &lt;&gt;
        {ref.current !== null &amp;&amp;
          createPortal(&lt;span&gt;Hello!&lt;/span&gt;, ref.current as any)}
        &lt;div ref={ref}&gt;&lt;/div&gt;
      &lt;/&gt;
    );
  </code></pre>
  
  <p>As far as I understand portals, a <code>span</code> should be appended to the <code>div</code>, however it is not.</p>
  
  <p>Why is that so?</p>