简体   繁体   English

如何在 React js web 应用程序中获取 DeviceInfo 和 DeviceId 不是 React-Native 应用程序

[英]How to get DeviceInfo and DeviceId in React js web application Not React-Native Application

I have Installed React-native-device-info API in my React js project.我在我的 React js 项目中安装了 React-native-device-info API。 But when running npm start command in command prompt it was throwing error like " Module not found: Can't resolve 'react-native' in '\node_modules\react-native-device-info\lib\module'.但是当在命令提示符下运行 npm start 命令时,它会抛出类似“找不到模块:无法解析 '\node_modules\react-native-device-info\lib\module' 中的 'react-native' 的错误。

I have tried all the solutions on google.我已经尝试了谷歌上的所有解决方案。 But the implementations are related to react-native applications only.但这些实现仅与 react-native 应用程序相关。 I need some help how to get deviceinfo and deviceid for REACTJS web application.我需要一些帮助来获取 REACTJS web 应用程序的 deviceinfo 和 deviceid。

use the library => react-device-detect link: https://www.npmjs.com/package/react-device-detect使用库 => react-device-detect 链接: https://www.npmjs.com/package/react-device-detect

Detect device, and render view according to the detected device type.检测设备,并根据检测到的设备类型渲染视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM