JSFiddle - React, Tailwind, and code Playground
HTML
<button id="btn">pew</button>
<pre id="out"></pre>
JavaScript
const iterator = foo(12);
btn.onclick = function() {
out.textContent += `Hello from here, ${iterator.next().value}\n`;
};
function* foo(n) {
while (true) yield n++;
}