【发布时间】:2020-11-01 16:20:44
【问题描述】:
我使用tsc --init 生成了 tsconfig.json,
然后我在 .tsx 文件中编写了 react 代码,得到了错误 Cannot use JSX unless the '--jsx' flag is provided
我偶然发现了 tsconfig 的 jsx 设置
jsx 在评论模式下为 // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
那么这三个选项是什么意思?即preserve、react-native和react
【问题讨论】:
标签: reactjs typescript jsx