JSFiddle - React, Tailwind, and code Playground

HTML

<ol id = "root">
    <li>List item two with subitems (this should not be numbered):
        <ol id = "toc0">
            <li>Subitem 1 (This should be numbered 1)</li>
            <li>Subitem 2 (This should be 2)</li>
              <ol>
                <li> subitem  (this should be 2.1)</li>  
                <li> subitem  (this should be 2.2)</li>  
                  <ol>
                    <li> subitem (This should be 2.2.1)</li>
                    <li> subitem (This should be 2.2.2)</li>
                  </ol>
              </ol>
            <li>Subitem 3 (This should be 3)</li>
            <li>Subitem 4 (This should be 4)</li>
        </ol>
    </li>
</ol>

CSS

ol li ol {
  counter-reset: section;                /* Creates a new instance of the
                                            section counter with each ol
                                            element */
  list-style-type: none;
}

ol li ol li::before {
  counter-increment: section;            /* Increments only this instance
                                            of the section counter */
  content: counters(section, ".") " ";   /* Combines the values of all instances
                                            of the section counter, separated
                                            by a period */
}