title: Error: Target container is not a DOM element with React
body: <p>I've made this React app but i keep getting this error:</p>
  <blockquote>
  <p>Uncaught Error: createRoot(...): Target container is not a DOM element.</p>
  </blockquote>
  <p>Can someone help me please? This is my index.html and index.js.</p>
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;en&quot;&gt;
    &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot; /&gt;
      &lt;link rel=&quot;icon&quot; href=&quot;%PUBLIC_URL%/favicon.ico&quot; /&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot; /&gt;
      &lt;meta name=&quot;theme-color&quot; content=&quot;#000000&quot; /&gt;
      &lt;meta
        name=&quot;description&quot;
        content=&quot;Web site created using create-react-app&quot;
      /&gt;
      &lt;link rel=&quot;apple-touch-icon&quot; href=&quot;%PUBLIC_URL%/logo192.png&quot; /&gt;
  
      &lt;link rel=&quot;manifest&quot; href=&quot;%PUBLIC_URL%/manifest.json&quot; /&gt;
  
      &lt;title&gt;React App&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;noscript&gt;You need to enable JavaScript to run this app.&lt;/noscript&gt;
      &lt;div id=&quot;root&quot;&gt;&lt;/div&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <pre class="lang-js prettyprint-override"><code>import React from &quot;react&quot;;
  import ReactDOM from &quot;react-dom/client&quot;;
  import App from &quot;./App&quot;;
  import reportWebVitals from &quot;./reportWebVitals&quot;;
  
  ReactDOM.createRoot(
    &lt;React.StrictMode&gt;
      &lt;App /&gt;
    &lt;/React.StrictMode&gt;,
    document.getElementById(&quot;root&quot;)
  );
  
  reportWebVitals();
  </code></pre>
  <p>I've already tried every possible solutions that are uploaded to the internet, but unfortunately non of them hasn't worked yet.</p>