1.1.4 • Published 1 year ago

device-type-detector v1.1.4

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

device-type-detector

React module to detect OS / Browser / Device

npm version GitHub issues GitHub license npm npm npm

Install

NPM

$ npm install device-type-detector --save

Yarn

$ yarn add device-type-detector

How to use in React

import React, { useEffect, useState } from 'react';
import { getDeviceType } from 'device-detector';

const App = () => {
const [deviceType, setDeviceType] = useState('');

useEffect(() => {
const type = getDeviceType();
setDeviceType(type);
}, []);

return (
<div>
<h1>Device Detector</h1>
<p>Your device type is: {deviceType}</p>
</div>
);
};

export default App;

How to use in Javascript

const deviceType = getDeviceType();
console.log(deviceType); // Outputs: 'mobile', 'tablet', 'desktop', or 'unknown'

License

MIT License

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago