[英]Error: 'React' must be in scope when using JSX
在 debian 10 上用 React 做一个测试项目,在 Windows 上用 VScode 8.1,当在项目文件夹中使用命令yarn start
时,出现错误:
./src/App.js
Line 6: 'React' must be in scope when using JSX react/react-in-jsx-scope
Line 7: 'React' must be in scope when using JSX react/react-in-jsx-scope
Line 8: 'React' must be in scope when using JSX react/react-in-jsx-scope
Line 9: 'React' must be in scope when using JSX react/react-in-jsx-scope
Line 10: 'React' must be in scope when using JSX react/react-in-jsx-scope
Line 12: 'React' must be in scope when using JSX react/react-in-jsx-scope
import React from 'react';
或"react/react-in-jsx-scope": "off"
。 还有什么问题?
从“反应”导入反应
这将解决问题
我遇到了同样的问题,通过运行 npm audit fix --force 解决了。 我会尝试重新安装软件包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.