英文:
Eslint 'React' must be in scope when using JSX react/react-in-jsx-scope
问题
When I run yarn eslint .
I got this result:
5:10 error 'React' must be in scope when using JSX react/react-in-jsx-scope
✖ 1 problem (1 error, 0 warnings)
The problem is that in this file, I don't need to import React because the IDE is showing:
'React' is declared but its value is never read.ts(6133)
So what do I do to resolve this situation?
英文:
When I run yarn eslint .
I got this result:
5:10 error 'React' must be in scope when using JSX react/react-in-jsx-scope
✖ 1 problem (1 error, 0 warnings)
The problem is that in this file, I dont need to import React, because the IDE showing:
'React' is declared but its value is never read.ts(6133)
So what do I do to resolve this situation?
答案1
得分: 2
React的新版本在编写JSX时不需要导入React,并且为了修复eslint,这是答案:https://stackoverflow.com/a/64646593/11410031
英文:
React in new version doesn't need to import React when writing JSX, and to fix eslint, this is the answer: https://stackoverflow.com/a/64646593/11410031
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论