Skip to main content
This guide will walk you through using the BugByBug React SDK in your project.
1

Install the SDK

You can install the BugByBug React SDK via npm.
npm install @bugbybug/react
2

Import into your app

Initialization the SDK into your index.js or main.ts
react init code here

3. Basic Usage

Once initialized, you can start using the SDK to capture bugs and errors.

Manually capturing an Error

The SDK automatically captures errors within your projects, although, you still have the choose to capture or catch these errors manually like this:
try {
  this.doSomethingRisky();
} catch (error) {
  this.bugByBug.captureException(error, { component: 'LoginComponent' });
}

Identifying users within your authentication

You can use BugByBugService in your authentication component to set the user context.
import { Component } from '@angular/core';
import { BugByBugService } from '@bugbybug/angular';

@Component({ ... })
export class LoginComponent {
  constructor(private bugByBug: BugByBugService) {}

  onLoginSuccess(user: any) {
    this.bugByBug.setUser(user.id, user.email);
  }
}
For more detailed information on other framework integrations, refer to their dedicated guides:

API Reference

For a complete list of available methods and their signatures, refer to the API Reference.