Function getDeviceType

  • Detects the current device type (mobile or desktop) based on the browser's user agent.

    Returns "mobile" | "desktop"

    "mobile" if the device is identified as a mobile or tablet, otherwise "desktop".

    const type = getDeviceType();
    console.log(type); // "mobile" or "desktop"