How can I log a variable in React Native, like using console.log
when developing for web?
相关问题
- React Native Inline style for multiple Text in sin
- I want to trace logs using a Macro multi parameter
- Error message 'No handlers could be found for
- convert logback.xml to log4j.properties
- Django management command doesn't show logging
相关文章
- how do I log requests and responses for debugging
- Why do we have to call `.done()` at the end of a p
- Remove expo from react native
- React Native - Dynamic Image Source
- Android Studio doesn't display logs by package
- “Unfortunately, app has stopped” error with buildi
- eslint Parsing error: Unexpected token =
- How to determine JS bottlenecks in React Native co
Just console.log('debug');
And run it you can see the log in the terminal/cd prompt .
Something that just came out about a month ago is "Create React Native App," an awesome boilerplate that allows you (with minimal effort) to show what your app looks like live on your mobile device (ANY with a camera) using the Expo app. It not only has live updates, but it will allow you to see the console logs in your terminal just like when developing for the web, rather than having to use the browser like we did with React Native before.
You would, of course, have to make a new project with that boilerplate... but if you need to migrate your files over, that shouldn't be a problem. Give it a shot.
Edit: Actually it doesn't even require a camera. I said that for scanning a QR code, but you can also type out something to sync it up with your server, not just a QR code.
If you are on osx and using an emulator, you can view your
console.log
s directly in safari web inspector.Safari => Development => Simulator - [your simulator version here] => JSContext
I prefer to recommend you guys using React Native Debugger. You can download and install it by using this command.
brew update && brew cask install react-native-debugger
or
Just check the link below.
https://github.com/jhen0409/react-native-debugger
Happy Hacking!
You can do this in 2 methods
1> by using warn
2> By using Alert This is not good each times if it reaches alert then each time pop will be opened so if doing looping means not preferable to use this
Visual Studio Code has a decent debug console that can show your console.log.
VS Code is, more often than not, React Native friendly.