react-native - react 原生 : 'React' refers to a umd global but the current file is a module consider adding an import instead

标签 react-native

添加 时出现此错误查看 中的组件.tsx 文件。

最佳答案

不需要使用 * 导入所有内容
它只是缺少的 react ,需要导入以便可以理解 JSX。
所以只要做以下

import React from 'react';

关于react-native - react 原生 : 'React' refers to a umd global but the current file is a module consider adding an import instead,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46276558/

相关文章:

android - <Image> url 没有显示为 android React Native

react-native - react native Flex 高度

react-native - TypeORM 与 React Native

ios - react-native - 在没有 Apple 开发者帐户的情况下部署到 iOS

javascript - React Native - 无法获取数组中的项目,或无法在列表中显示数组中的项目

reactjs - React Native MapBox 获取点击位置

javascript - React Native - 检索 AsyncStorage 中除键之外的所有内容?

javascript - -React Native,从A.js到B.js传递状态数据的方式是什么

reactjs - 可以在electronjs应用程序中使用react-primitives?

javascript - 难以理解去除箭头函数的值(value) () =>