Sometimes, we want to add logging in React Native.
In this article, we’ll look at how to add logging in React Native.
How to add logging in React Native?
To add logging in React Native, we can use console
.
For instance, we write:
import * as React from 'react';
import { View, StyleSheet } from 'react-native';
import { Text } from 'react-native-paper';
export default class MyComponent extends React.Component {
render() {
console.log('hello');
console.warn('warning');
return <View></View>;
}
}
to call console.log
to log messages and console.warn
to log warnings.
Conclusion
To add logging in React Native, we can use console
.