You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/platforms/javascript/guides/react/configuration/integrations/react-router.mdx
+57-1Lines changed: 57 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,63 @@ The React Router integration is designed to work with our Tracing SDK, `@sentry/
15
15
16
16
</Alert>
17
17
18
-
We support integrations for React Router 3, 4 and 5.
18
+
We support integrations for React Router 3, 4, 5, and 6.
19
+
20
+
## React Router v6
21
+
_(Available in version 7 and above)_
22
+
23
+
To use React Router v6 with Sentry:
24
+
25
+
1. Initialize `Sentry.reactRouterV6Instrumentation` as your routing instrumentation and provide the functions it needs to enable performance tracing:
26
+
27
+
-`useEffect` hook from `react`
28
+
-`useLocation` and `useNavigationType` hooks from `react-router-dom`
29
+
-`createRoutesFromChildren` and `matchRoutes` functions from `react-router-dom` or `react-router` packages.
30
+
31
+
2. Wrap [`Routes`](https://reactrouter.com/docs/en/v6/api#routes-and-route) using `Sentry.withSentryReactRouterV6Routing` to create a higher order component, which will enable Sentry to reach your router context, as in the example below:
Now, Sentry should generate `pageload`/`navigation` transactions with parameterized transaction names (for example, /teams/:teamid/user/:userid), where applicable.
0 commit comments