How to do logging in React Native?

前端 未结 30 3478
不思量自难忘°
不思量自难忘° 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:40

    You can do this in 2 methods

    1> by using warn

    console.warn("somthing " +this.state.Some_Sates_of_variables);
    

    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

    Import the {Alert} from 'react-native'
       // use this alert
       Alert.alert("somthing " +this.state.Some_Sates_of_variables);
    

提交回复
热议问题