New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

use-mobile-detect-hook

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-mobile-detect-hook

The React hook to detect if the device is mobile or desktop.


Version published
Maintainers
1
Created

use-mobile-detect-hook

React hook to detect the device type. This hook is able to detect mobile, desktop, android or iOS device.

Installing

npm install use-mobile-detect-hook
yarn add use-mobile-detect-hook

Usage

import useMobileDetect from 'use-mobile-detect-hook';

function MyComponent  = (props) => {
  const detectMobile = useMobileDetect();

  return (
      <div>
        is Mobile: { detectMobile.isMobile() } <br/>
        is Desktop: { detectMobile.isDesktop() } <br/>
        is Android: { detectMobile.isAndroid() } <br/>
        is iOS: { detectMobile.isIos() }
      </div>
  );
};

Contributing

If you have any new suggestions, new features, bug fixes, etc. please contribute by raising pull request on the https://github.com/haldarmahesh/use-mobile-detect-hook.

If you have any issue with the use-mobile-detect-hook, open an issue on https://github.com/haldarmahesh/use-mobile-detect-hook.

FAQs

Package last updated on 02 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts