This tutorial explains how to perform debugging using console.log() in react native application. Console.log() is a inbuilt and predefined function present in javascript. This function is created for both Android and iOS applications and used to maintain and debug errors in apps on run time. Console.log() helps us to detect errors in our code.
In this example we are using console.log statement inside the function and that function mapped to the button as a click listener. When user perform click event on the button, then it will print console.log statement message in the console. Lets use the below complete source code for logging a message in console, that ultimately help you to debug the code.
App.js
Screenshot :
If you would like to see the console log statement in react native application, then you need to again execute react-native log-android command in command prompt in windows and In iOS we would use react-native log-ios command in terminal.
For example. here we are using debugging statement in android emulator using react native application. lets apply the below command and for more info refer the screenshot.
command used :
react-native log-android
After that perform click event on the button, then it will print console.log statement message in the console.
This is all about Debug React Native Android or iOS App Using Console log. Thank you for reading this article, and if you have any problem, have a another better useful solution about this article, please write message in the comment section.
In this example we are using console.log statement inside the function and that function mapped to the button as a click listener. When user perform click event on the button, then it will print console.log statement message in the console. Lets use the below complete source code for logging a message in console, that ultimately help you to debug the code.
React Native Debugging
App.js
Screenshot :
If you would like to see the console log statement in react native application, then you need to again execute react-native log-android command in command prompt in windows and In iOS we would use react-native log-ios command in terminal.
For example. here we are using debugging statement in android emulator using react native application. lets apply the below command and for more info refer the screenshot.
command used :
react-native log-android
After that perform click event on the button, then it will print console.log statement message in the console.
This is all about Debug React Native Android or iOS App Using Console log. Thank you for reading this article, and if you have any problem, have a another better useful solution about this article, please write message in the comment section.
No comments:
Post a Comment