react-device-detector-hook
v1.0.8
Published
The React hook to detect if the device is mobile or desktop.
Downloads
12
Maintainers
Readme
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.