How to do logging in React Native?

前端 未结 30 3573
不思量自难忘°
不思量自难忘° 2020-11-30 17:08

How can I log a variable in React Native, like using console.log when developing for web?

30条回答
  •  天涯浪人
    2020-11-30 17:25

    Use console.debug("text");

    You will see the logs inside the terminal.

    Steps:

    • Run the application:
    react-native run-ios        # For iOS
    react-native run-android    # For Android
    
    • Run the logger:
    react-native log-ios        # For iOS
    react-native log-android    # For Android
    

提交回复
热议问题