简体   繁体   English

安装 React 时出现 React Native 错误(ReferenceError:找不到变量:React)?

[英]React Native Error (ReferenceError: Can't find variable: React) when React is installed?

Overview:概述:

I created a NPM dependency react-native-ultimate-modal-picker and it relies on a few other dependencies.我创建了一个 NPM 依赖项react-native-ultimate-modal- picker ,它依赖于其他一些依赖项。

Expected Behavior:预期行为:

  • React should be installed because it's installed in the fresh react project.应该安装 React,因为它安装在新的 react 项目中。

Error:错误:

ReferenceError: Can't find variable: React

What I've tried我试过的

So what am I missing here?那么我在这里错过了什么?

You can try a few things.你可以尝试几件事。

Try importing react like import React from 'react' at the beginning of your project尝试在项目开始时像import React from 'react'一样导入 react

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

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