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

2.0.2 • Public • Published

npm version

modify

add pr for caching

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 @groupher/use-mobile-detect-hook

Weekly Downloads

24

Version

2.0.2

License

MIT

Unpacked Size

5.48 kB

Total Files

4

Last publish

Collaborators

  • mydearxym