admin管理员组

文章数量:1794759

见鬼,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 }, }

本文标签: 出现了文件ReactrefersTS