Check your device when you have anything to change on your PC or mobile.
❤️ it? ⭐️ it on GitHub
opgg-use-device-detector basically provides physical device data and logical device data.
Physical device: Device information that was accessed when the site was first accessed.
Logical device: Device information that changes internally when changing the current state to an arbitrary device.
opgg-use-device-detector, you must use
[email protected] or greater which includes Hooks.
$ npm i opgg-use-device-detector
import useDeviceDetector from 'opgg-use-device-detector' const deviceDetector = useDeviceDetector(initialState, deviceDetectorConfig)
initialState and an optional
deviceDetectorConfig object. The configuration object may contain the following keys.
||A string that will be used by the
||A storage provider. Default =
This version does not provide local storage usage and onChange functions.
deviceDetector object is returned with the following properties.
||Device information on the first visit.|
||Logically changed device information.|
||Check current state. (
||A function that allows you to toggle ‘smartphone’ or ‘desktop’.|