JSFiddle - React, Tailwind, and code Playground

by Aamir Shahzad

JavaScript

function isTouchDevice() {
    return true == ("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch);
}
if (isTouchDevice() === true) {
    alert('Touch Device'); //your logic for touch device here
} else {
    alert('Not a Touch Device'); //your logic for non touch device here
}