JSFiddle - React, Tailwind, and code Playground

HTML

<html>
<body>
<div id="main">
</div>
</body>
</html>

CSS

td {
  border: 1px solid black;
}

thead {
  color: red;
}

JavaScript

const table = document.createElement("TABLE");
  const thead = table.createTHead();
  const tr = thead.insertRow();
  const th1 = tr.insertCell();
  th1.textContent = "header1";
  const th2 = tr.insertCell();
  th2.textContent = "header2";

  const tr2 = table.insertRow()
  const td1= tr2.insertCell();
  td1.textContent = "field1";
  const td2 = tr2.insertCell();
  td2.textContent = "field2";

  document.getElementById("main").appendChild(table);