typescript - 无法在 TS 中使用模块,新手在这里
问题描述
所以我一直在尝试使用 React Native 和 Typescript 构建 Web 应用程序,但我无法添加按钮。我可以在组件中添加按钮,然后在我的 tsx 中使用它,但是当我尝试从 github 添加此按钮时,https://github.com/rcaferati/react-native-really-awesome-button 当我尝试添加这个按钮到我的代码我在 TS 中收到此错误。
import AwesomeButtonRick from "react-native-really-awesome-button";
function Button() {
return <AwesomeButtonRick>Text</AwesomeButtonRick>;
}
另外,我使用 AwesomeButton 还是 AwesomeButtonRick 也没关系。
'AwesomeButtonRick' 不能用作 JSX 组件。它的实例类型“AwesomeButton”不是有效的 JSX 元素。“AwesomeButton”类型缺少“ElementClass”类型的以下属性:render、context、setState、forceUpdate 和 3 more.ts(2786)
我尝试更新依赖项和所有内容,你能告诉我我做错了什么吗?
解决方案
推荐阅读
- java - 为什么 for 循环不适用于 array.size()?
- javascript - for、while 和 do while 循环之间到底有什么区别?在哪种情况下我应该使用每种情况?
- flutter - 未处理的异常:FormatException:不是有效的链接本地地址,但包含 %
- node.js - apt 命令无法找到 npm 和节点包
- angular - Devexpress Datagrid 图标图像过滤器不显示角度
- java - Windows 10 上的 TLS 1.3 密钥更新问题
- c# - 如何在 ASP.NET Core 中实现表单重置按钮?
- python - 在 AWS 上部署 django 时出现 Pytorch 导入错误
- python - Elif 语句似乎没有正确读取变量
- javascript - 在 Shopify 中刷新异步购物车以更新忠诚度积分值