React Developer Tools not appearing in Chrome
Advice on how/if I should be building a chrome extension with react.js
reactjs - Why does chrome detect a react app and ask to download it - Stack Overflow
Using chrome api with React.js - javascript
Videos
For some reason I cannot find the developer tools in Chrome. Why could that be?
I posted my question in StackOverflow, but I hope I could find here a solution faster:
https://stackoverflow.com/questions/77421852/react-developer-tools-wont-appear-in-chrome
I uploaded pictures in that link, in case you want to see it directly.
Please help!
Exactly what the title says. I'm having to work with content_scripts and background. Wondering if anyone has any advice to give on this topic and whether it scales well when using chrome.storage.
tldr: Does react.js mix poorly with manifest V3 protocols?
UPDATE: React works just fine with manifest V3, I actually recommend using it. The SPA of react works extremely well in reducing the load on a server required to run your application. I highly recommend using react AND chrome.storage. It has 5-10MB of storage which is an insane amount that can be leverage either for later use once your application gets funding or is great just because it too can reduce server load and is very safe to use.
HOPE THE UPDATE HELPS
You can define chrome by adding /*global chrome*/ in the top of the file.
For Example
/*global chrome*/
import React, { Component } from 'react';
import './App.css';
class App extends Component {
componentWillMount() {
chrome.storage.local.set({ 'data' : 'Your data'}, function(result) {
console.log(" Data saved ")
});
}
render() {
return (
<div className="App">
</div>
);
}
}
export default App;
So it appears putting /*global chrome*/ on top of file works, but I would like to explain why it works -
First of all you are using React, and the eslint configuration of React is hidden internally and by default the no-undef rule is enabled, so you can not use the undefined variable chrome in order to allow this you have to tell eslint to let it allow compilation even if chrome is undefined.
It has nothing to do with react or typescript, its an es-lint issue.
Here I will show you an example on eslint playground -

Upon running the code above I will get that console is not defines, and the reason for that is eslint is unaware of console API
You have various options to resolve the issue -
- You can add
browserif you are using browser in the env, but in your case you can usewebExtensionsto true - you can define globals in config file, using
{"global" : {}}as also mentioned in another answer. - temporarily you can do
/* global your_identifier */
Right thing to do would be change your env in eslint config as follows
"env": {
"webextensions": true
}
For more visit
- 1 - https://eslint.org/docs/latest/rules/no-undef
- 2 - https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-globals
» npm install react-devtools

Example of site that does
