React Router v3

Learn about Sentry's React Router v3 integration.

To use the router integration, import and set a custom routing instrumentation and pass it the history, your routes and a match function. React Router v3 support is maintained for React Router >= 3.2.0 and < 4.0.0.

Copied
import * as Router from "react-router";

import * as Sentry from "@sentry/react";

// Routes looks like this:
const routes = (
  <Route path="/">
    <Route path="organizations/">
      <Route path=":orgid" component={() => <div>OrgId</div>} />
      <Route path=":orgid/v1/:teamid" component={() => <div>Team</div>} />
    </Route>
  </Route>
);

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0
example-org / example-project
"
,
integrations: [ Sentry.reactRouterV3BrowserTracingIntegration({ history: Router.browserHistory, // Must be Plain Routes. routes: Router.createRoutes(routes), match: Router.match, }), ], // We recommend adjusting this value in production, or using tracesSampler // for finer control tracesSampleRate: 1.0, });

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").