Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.


Repository files navigation

Deprecation notice

We upgraded our React support in the latest all-in-one javascript notifier package. Check out the blog post for more info.

All projects should upgrade to our universal JS notifier: @bugsnag/js and use the new version of the react plugin: @bugsnag/plugin-react. See the upgrade guide for details on how to upgrade.

This package is now deprecated, but will continue to exist on the npm registry and work with Bugsnag's API for the foreseeable future. However, it will no longer receive updates unless they are critical.

Please upgrade at your earliest convenience.

Bugsnag: React

Documentation Build status NPM


A bugsnag-js plugin for React. Learn more about error reporting for React applications with Bugsnag.

This package enables you to integrate Bugsnag's error reporting with React's error boundaries. It creates and configures an <ErrorBoundary/> component which will capture and report unhandled errors in your component tree. You either use the <ErrorBoundary/> directly, or extend it to provide some fallback UI for your users.

Reported errors will contain useful debugging info from Reacts's internals such as the component name where the error originated, and the component stack.


You can opt to install the package from npm, using the instructions below. Alternatively you can load the plugin from our CDN via a <script/> tag.


<script src="//"></script>
<script src="//"></script>


npm i --save bugsnag-js bugsnag-react
# or
yarn add bugsnag-js bugsnag-react


Depending on how your application is structured, usage differs slightly:

Inline script tag

The script tag creates a global function called bugsnag__react which needs to be passed a reference to the React object. Ensure that React is defined before calling this function.

  window.bugsnagClient = bugsnag('API_KEY')
  // in your react app…
  var ErrorBoundary = bugsnagClient.use(bugsnag__react(React))
      <YourApp />

See the example for more info.


// initialize bugsnag ASAP, before other imports
import bugsnag from 'bugsnag-js'
const bugsnagClient = bugsnag('API_KEY')

import ReactDOM from 'react-dom'
import React from 'react'
import createPlugin from 'bugsnag-react'

// wrap your entire app tree in the ErrorBoundary provided
const ErrorBoundary = bugsnagClient.use(createPlugin(React))
    <YourApp />



The Bugsnag JS library and official plugins are free software released under the MIT License. See LICENSE.txt for details.