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: docs/platforms/javascript/guides/react/features/react-router/v6.mdx
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,11 @@ description: "Learn how to instrument your React Router v6 application with Sent
4
4
sidebar_order: 20
5
5
---
6
6
7
-
Apply the following setup steps based on your routing method and create a [custom error boundary](#custom-error-boundaries) to make sure Sentry automatically captures rendering errors.
7
+
Apply the following setup steps based on your routing method and create a [custom error boundary](#usage-with-custom-error-boundaries) to make sure Sentry automatically captures rendering errors:
## Usage with `createBrowserRouter` or `createMemoryRouter`
10
14
@@ -148,9 +152,11 @@ ReactDOM.render(
148
152
149
153
Now, Sentry should generate `pageload`/`navigation` transactions with parameterized transaction names (for example, `/teams/:teamid/user/:userid`), where applicable. This is only needed at the top level of your app, unlike React Router v4/v5, which required wrapping every `<Route />` you wanted parametrized.
150
154
151
-
## Custom Error Boundaries
155
+
## Usage With Custom Error Boundaries
152
156
153
-
When using `react-router`, errors thrown inside route elements will only be re-thrown in **development mode** while using [`strict mode`](https://react.dev/reference/react/StrictMode). In production, these errors won't be surfaced unless manually captured. If you **don't** have a custom error boundary in place, `react-router` will create a default one that "swallows" all errors.
157
+
When using `react-router`, errors thrown inside route elements will only be re-thrown in **development mode** while using [`strict mode`](https://react.dev/reference/react/StrictMode).\
158
+
In production, these errors won't surface unless captured manually. If you **don't** have a custom error boundary in place, `react-router` will create a default one that "swallows" all errors.\
159
+
Hence, to capture these errors with Sentry in production, we strongly recommend to implement a custom error boundary.
154
160
155
161
<Alert>
156
162
This only applies to render method and lifecycle errors since React doesn't
## Usage with `createBrowserRouter` or `createMemoryRouter`
16
20
@@ -152,9 +156,11 @@ ReactDOM.render(
152
156
153
157
Now, Sentry should generate `pageload`/`navigation` transactions with parameterized transaction names (for example, `/teams/:teamid/user/:userid`), where applicable. This is only needed at the top level of your app, unlike React Router v4/v5, which required wrapping every `<Route />` you wanted parametrized.
154
158
155
-
## Custom Error Boundaries
159
+
## Usage With Custom Error Boundaries
156
160
157
-
When using `react-router`, errors thrown inside route elements will only be re-thrown in **development mode** while using [`strict mode`](https://react.dev/reference/react/StrictMode). In production, these errors won't be surfaced unless manually captured. If you **don't** have a custom error boundary in place, `react-router` will create a default one that "swallows" all errors.
161
+
When using `react-router`, errors thrown inside route elements will only be re-thrown in **development mode** while using [`strict mode`](https://react.dev/reference/react/StrictMode).\
162
+
In production, these errors won't surface unless captured manually. If you **don't** have a custom error boundary in place, `react-router` will create a default one that "swallows" all errors.\
163
+
Hence, to capture these errors with Sentry in production, we strongly recommend to implement a custom error boundary.
158
164
159
165
<Alert>
160
166
Note, that this only applies to render method and lifecycle errors since React
0 commit comments