use-mobile-detect-hook
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

npm version

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

Demo

Follow this link to check the demo.

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 repository.

If you have any issue with the use-mobile-detect-hook, open an issue on Github.

Package Sidebar

Install

npm i use-mobile-detect-hook

Weekly Downloads

1,534

Version

1.0.5

License

MIT

Unpacked Size

5.35 kB

Total Files

5

Last publish

Collaborators

  • haldarmahesh