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
+46Lines changed: 46 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,51 @@ Make sure `Sentry.reactRouterV6Instrumentation` is initialized by your `Sentry.i
34
34
35
35
</Alert>
36
36
37
+
### Usage with React Router 6.4 Data API
38
+
_(Available in version 7.21.0 and above)_
39
+
40
+
41
+
If you choose to create your router instance with [`createBrowserRouter`](https://reactrouter.com/en/main/routers/create-browser-router) from the `react-router-dom` package, you can use `Sentry.wrapCreateBrowserRouter` to wrap it with the instrumentation:
While [`createHashRouter`](https://reactrouter.com/en/main/routers/create-hash-router) isn't supported by Sentry yet, you can instrument [`createMemoryRouter`](https://reactrouter.com/en/main/routers/create-memory-router) using the `wrapCreateBrowserRouter` function.
78
+
79
+
</Alert>
80
+
81
+
37
82
### Usage With `<Routes />` Component
38
83
39
84
If you use the `<Routes />` component from `react-router-dom` to define your routes, wrap [`Routes`](https://reactrouter.com/docs/en/v6/api#routes-and-route) using `Sentry.withSentryReactRouterV6Routing`. This creates a higher order component, which will enable Sentry to reach your router context, as in the example below:
0 commit comments