✅ 操作成功!

见鬼,TSC 编译 TS 文件出现了‘React‘ refers to a UMD global, but the current file is a module. Consider adding

发布时间:2023-06-12 作者:admin 来源:文学

见鬼,TSC 编译 TS 文件出现了‘React‘ refers to a UMD global, but the current file is a module. Consider adding

见鬼,TSC 编译 TS 文件出现了‘React‘ refers to a UMD global, but the current file is a module. Consider adding

这个错误是 TypeScript 编译器提示的。

解决办法

在 TSconfig 文件中配置 jsx: React-jsx 即可

{ "compilerOptions": { // ... "jsx": "react-jsx", // 编译后用 React.cloneElement 方法代替 jsx }, }
👁️ 阅读量:0