supportsTouchEvents

Checks if touch events are supported.

  • Check if 'ontouchstart' exists in window.
const supportsTouchEvents = () =>
  window && 'ontouchstart' in window;
supportsTouchEvents(); // true