I am getting following error. While import the JSX file in TSX File in React Native
我收到以下错误。在Reaction Native中导入TSX文件中的JSX文件时
Error
误差率
Unable to resolve module ../../components/Chart` from `StatisticalScreen.tsx:**<br>
None of these files exist:<br>
app/components/Chart(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
Chart.jsx file
Chart.jsx文件
import { View, Text } from "react-native"
const Chart = () => {
return (
<View>
<Text>Your Component</Text>
</View>
)
}
export default Chart
I had tried to change in the tsConfig file to allowJs:true but not working.
我曾尝试在tsConfig文件中将其更改为AllowJs:True,但不起作用。
更多回答
Any reason you can't change Cart.jsx
to a Chart.tsx
?
有什么理由不能将Cart.jsx更改为Chart.tsx吗?
I had long third party code. thats difficult to convert code
我有很长的第三方代码。这很难转换代码
primary convert is as simple as renaming jsx to tsx. no need to handle types immedeately, you can do it later. if your webpack does not built if you have errors, you can just add ignore to the fileto skip type check. just dont forget to fix it later
主转换非常简单,只需将JSX重命名为TSX。不需要立即处理类型,您可以稍后再处理。如果你的webpack没有建立如果你有错误,你可以只添加忽略到文件跳过类型检查。只是以后别忘了修好它
优秀答案推荐
我是一名优秀的程序员,十分优秀!