TanStack Router
Learn about Sentry's TanStack Router integration.
(Available in version 8.7.0 and above)
TanStack Router support is included in the @sentry/react
package since version 8.7.0
and is only compatible with version 1.34.5
of @tanstack/router` and above.
Note
The TanStack Router integration is designed to work with Sentry Performance Monitoring. Please see Getting Started with React Performance for more details on how to set up and install the SDK.
The TanStack Router instrumentation uses your TanStack Router routes to create pageload/navigation
transactions to ensure you collect meaningful performance data about the health of your page loads and associated requests.
To use the TanStack Router integration, pass the Sentry.tanstackRouterBrowserTracingIntegration
inside your integrations
option:
Copied
import * as Sentry from "@sentry/react";
import { createRouter } from "@tanstack/react-router";
const router = createRouter({
// Your router options...
});
Sentry.init({
dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
integrations: [Sentry.tanstackRouterBrowserTracingIntegration(router)],
// Setting a sample rate is required for sending performance data.
// We recommend adjusting this value in production, or using tracesSampler
// for finer control.
tracesSampleRate: 1.0,
});
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").
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").