我正在用create React应用程序构建React应用程序.
I got the following error when running ESLint:
8:3 error 'document' is not defined no-undef.
我的应用程序运行正常,但我在两个文件中发现了这个ESLint错误.
指数jsx:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './index.css';
ReactDOM.render(
<App />,
document.getElementById('root'),
);
eslintrc.js:
module.exports = {
"extends": "airbnb",
"plugins": [
"react",
"jsx-a11y",
"import"
],
"env": {
"jest": true
}
};
我该怎么解决这个问题?目前我将忽略这两个文件...但我宁愿找到一个长期的解决方案.