I got this warning in the console:
💡 JavaScript logs will be removed from Metro in React Native 0.77!
Does this mean that all my console.logs should be changed to React Native Tool logs?
If so, is there a method to change it easily?
Fortunately not, as this is just referring to the forwarding of JavaScript log messages to Metro (the React Native JavaScript bundler), which prints them to the terminal where the development server is running (e.g. npx expo run:ios).
console.log() messages also appear on the Console tab/section in the React Native DevTools.
This post explains the reasoning:
Why are JavaScript logs leaving Metro?
We want every aspect of React Native debugging to behave reliably, and to match the functionality of modern browser tooling. To meet this quality bar, we are removing log forwarding via Metro in 0.77, with a warning logged today.
- Maintainability: This feature was historically an ad-hoc forwarding protocol over the bundler connection which we no longer wish to maintain.
- Web alignment, separation of concerns: Application logs in Metro pollute the primary information logged by Metro/the dev server, such as when bundles are sent to a device. No other bundlers replicate this functionality.
- For a web app, you wouldn’t forward logs in the dev server. Instead, these tools only log bundle requests, and you go to a particular instance of the webpage/app to open the browser DevTools.
Please use React Native DevTools and its fully featured Console panel — supporting log filtering, rich object inspection, and Live Expressions.
If you really want to view inline logs in your IDE, the modern approach would be to consider one of the third party VS Code offerings, which stream logs over CDP.
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