How can I log a variable in React Native, like using console.log
when developing for web?
Its so simple to get logs in React-Native
Use console.log and console.warn
console.log('character', parameter)
console.warn('character', parameter)
This log you can view in browser console. If you want to check device log or say production APK log you can use
adb logcat
adb -d logcat
Use react native debugger for logging and redux store https://github.com/jhen0409/react-native-debugg
Just download it and run as software then enable Debug mode from the simulator.
It supports other debugging feature just like element in chrome developer tools, which helps to see the styling provided to any component.
Last complete support for redux dev tools
console.log()
is the best and simple way to see your log on console when you use remote js debugger from your developer menu
Pre React Native 0.29, run this in the console:
adb logcat *:S ReactNative:V ReactNativeJS:V
Post React Native 0.29, run:
react-native log-ios
or
react-native log-android
As Martin said in another answer.
This shows all console.log(), errors, notes, etc. and causes zero slow down.
Visual Studio Code has a decent debug console that can show your console.log.
VS Code is, more often than not, React Native friendly.
You can use remote js debugly option from your device or you can simply use react-native log-android and react-native log-ios for ios.