JSFiddle - React, Tailwind, and code Playground

HTML

<h2>Foo is red</h2>
<h3>Bar is green</h3>

JavaScript

var styles = [
    "h2 { color: red; }",
    "h3 { color: green; }"
];
$("<style>" + styles.join("") + "</style>").appendTo("head");