JSFiddle - React, Tailwind, and code Playground

HTML

<p>Print</p>
<p id="demo"></p>

JavaScript

setInterval(function () {
var x = document.getElementById("demo");
var d = new Date();
var ms = d.getMilliseconds();
x.innerHTML = ms;

}, 100);

document.querySelector("p").addEventListener("click", function(e){
console.log(e)
e.preventDefault();
   //window.alert( 'hallo');
    var win = window.open('', '_blank');
    win.print();
    window.focus();
    return false
});