'Disable this console messages that appears in event handlers at React
How to disable these console messages when doing an event handler (like onChange) in react. It comes to this file called ContentScript.js but I don't know how to remove it. It's annoying and it sometimes makes me confused about the console.log message I'm reading when debuggin. The pic below is some project to show what I meant.
I'm using also the latest version of react on this. 18.1.0
This is the code.
function App() {
const [state, setState] = useState('')
const onChange =(e) => setState(e.target.value)
const onSubmit = (e) => {
e.preventDefault()
}
return (
<div className="App">
<form onSubmit={onSubmit}><input value={state} onChange={onChange}/> <button>Submit</button></form>
</div>
);
}
export default App;
Solution 1:[1]
You can use -
console.clear()
before calling your debug console.log()
It will clear your previous console messages.
Another workaround:
ContentScript.js is coming from your browser extension if it doesn't exist in your project. Disable all browser extension to stop getting unknown messages.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |