React‘ refers to a UMD global 或者 Cannot use JSX unless the ‘--jsx‘ flag is provided.

开发 typescript+react 项目 div等标签报红:
React’ refers to a UMD global, but the current file is a module. Consider adding an import instead

修改 tsconfig.json 文件

"compilerOptions": {
     "jsx": "react-jsx"
}

修改后如还是报: Cannot use JSX unless the ‘–jsx’ flag is provided.
需重启编辑器

你可能感兴趣的:(react.js,javascript,ecmascript)