Should you remove the console.log()
calls before deploying a React Native app to the stores? Are there some performance or other issues that exist if the console.log()
calls are kept in the code?
Is there a way to remove the logs with some task runner (in a similar fashion to web-related task runners like Grunt or Gulp)? We still want them during our development/debugging/testing phase but not on production.
Luckily, there's a simple way to remove console. log from production with little effort. The babel-plugin-transform-remove-console babel plugin helps you to remove all console.
Use the short cut Ctrl + L to clear the console. Use the clear log button on the top left corner of the chrome dev tools console to clear the console.
yes. More code means a longer execution time. Not only will it take unnecessary CPU "power", console. log is also synchronous so it will make your application slower (even by a few nanoseconds).
Well, you can always do something like:
if (!__DEV__) { console.log = () => {}; }
So every console.log
would be invalidated as soon as __DEV__
is not true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With