JSFiddle - React, Tailwind, and code Playground

HTML

<div id="test" style="background: red; width: 100px; height: 100px; touch-action: none"></div>

JavaScript

var click = false;

var test = document.getElementById('test');

function render() {
  test.innerText = (click ? 'click' : '');
}

document.addEventListener('click', function() {
  click = true;
  render();
});

document.addEventListener('touchstart', function(e) {
  e.preventDefault();
console.log('defaultPrevented', e.defaultPrevented);
  render();
}, { passive: false });