1.0.8 • Published 5 months ago

react-device-detector-hook v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

npm version

react-device-detector-hook

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

Installing

npm install react-device-detector-hook
yarn add react-device-detector-hook

Usage

import useDeviceDetector from 'react-device-detector-hook';




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


  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 react-device-detector-hook, open an issue on Github.