Stack Overflow Asked by machineghost on January 25, 2021
In React when things go wrong you often wind up with A LOT of error messages in your console. Some can be duplicates of the original error, and some are unrelated errors caused by the original error creating invalid conditions.
In a normal JS app this happens, just less often, because the first error generally halts code execution. But in React, its rendering strategy often results in new errors after existing ones (and often they’re quite verbose).
Thus, you often have a wall of text to scroll back up through on every refresh, when you actually need just: A) the original error, and/or B) the message React throws right after (ie. where that error actually occurred).
My question is:
Is it possible to configure any browser’s dev tools to collapse or hide error messages after the first two (since reloading)?
Can I use a configuration option, or an extension, or a global error handler that calls a console function I don’t know of, or something … to automatically make it so I only see the first two on reload?
Only showing first n errors/warning is not possible from the developer tools at least for Chrome 86.0.4240.75 or earlier.
If you want to create your own plugin, you can for sure achieve this!, but there are multiple things you can try to keep unnecessary logs filtered from the console.
For example, you can decide what level og messages you want to see:
or filter messages by text or regex from filter box
or filter messages from a particular file:
Learn more about log filtering from official guide.
Correct answer by Dipen Shah on January 25, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP