Categories
JavaScript Answers React Native Answers

How to add logging in React Native?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *