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

- 1 answer

Ad

I am using react and before defining one of my components I require a different component like this: var Storage = require('./StorageHistory'); eslint is giving me the error: "Storage" is read only no-undef. Any ideas as to why?

Ad

Answer

Ad

Storage is an interface to access localStorage or sessionStorage. It's a global variable in browsers and you are overriding it. Because of that ESLint is notifying you about potential error.

You can find more information about Storagehere.

Ad
source: stackoverflow.com
Ad