title: using insertAdjacentHTML with a React Component
body: <p>So I'm trying to recreate the Github contribution grid using React.</p>
  <p>I'm trying to use insertAdjacentHTML to populate the grid container with a bunch of divs that I can then style.</p>
  <p>However, React is throwing me an error &quot;TypeError: Cannot read property 'insertAdjacentHTML' of null&quot;</p>
  <p>Here is my simple code:</p>
  <pre><code>export default function NewHabit() {
    const gridContainer = document.querySelector('.grid-container');
  
    for (let i = 0; i &lt; 365; i++) {
      gridContainer.insertAdjacentHTML('beforeend', `&lt;div id=&quot;box&gt;&lt;/div&gt;`);
    }
  
    return (
      &lt;div&gt;
        &lt;div className=&quot;grid-container&quot;&gt;&lt;/div&gt;
      &lt;/div&gt;
    );
  }
  </code></pre>