Download Latest Version v2.2.3 source code.tar.gz (129.2 kB)
Email in envelope

Get an email when there's a new version of react-device-detect

Home / v2.0.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2021-09-26 1.1 kB
v2.0.0 source code.tar.gz 2021-09-26 71.3 kB
v2.0.0 source code.zip 2021-09-26 81.6 kB
Totals: 3 Items   153.9 kB 0

Package was completely rewritten. But there is not many breaking changes.

Breaking change:

Views doesn't accept viewClassName prop anymore, use className instead.

New type

New type isEmbedded was added, it returns if device type is embedded.

New hooks

useDeviceData and useDeviceSelectors hooks were introduces.

First returns all device data, second returns all available selectors. Both hooks accept either userAgent as prop, or take it from window.navigator.userAgent.

Enums

BrowserTypes and OsTypes are now exported from the package. They has not very big amount of entries for now, but they will be extended soon.

Utilities updates/additions

Added function getSelectorsByUserAgent which returns all selectors available for given user agent. User agent argument is mandatory.

Now deviceDetect accepts userAgent and returns all available data. Can be used in SSR.

Added function parseUserAgent which returns all available data for given user agent. Useful in SSR. User agent argument is mandatory.

Source: README.md, updated 2021-09-26