eslint 在需要反应组件时给出只读错误?

eslint is giving a read only error when requiring a react component?

我正在使用 React,在定义我的组件之一之前,我需要一个不同的组件,如下所示:var Storage = require('./StorageHistory'); eslint 给我错误:"Storage" is read only no-undef。关于为什么的任何想法?

Storage是访问localStorage或者sessionStorage的接口。它是浏览器中的全局变量,您正在覆盖它。因为 ESLint 会通知您潜在的错误。

您可以找到有关 Storage here 的更多信息。