React Native


Firstly, add the library to your project:

npm install --save raygun4js

Then in a central component (e.g index.ios.js/, import the library:

import rg4js from 'raygun4js';

Next, configure the provider using your Raygun application’s API key. These lines should be called once only early on when your app boots, for example:

export default class YourReactNativeProject extends Component {
  constructor() {

    rg4js('enableCrashReporting', true);
    rg4js('apiKey', 'add_your_api_key_here');

    // Put any other rg4js() options you want to set here

    rg4js('boot'); // This call must be made last to start the provider

Naturally, you can factor the above logic out into a function or separate component, which should be called early on from your main app component.

On this page: