Skip to content

Commit 3c4f6b5

Browse files
committed
update custom error boundary section; add ToC
1 parent 8d509ae commit 3c4f6b5

File tree

2 files changed

+19
-7
lines changed
  • docs/platforms/javascript/guides/react/features/react-router

2 files changed

+19
-7
lines changed

docs/platforms/javascript/guides/react/features/react-router/v6.mdx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ description: "Learn how to instrument your React Router v6 application with Sent
44
sidebar_order: 20
55
---
66

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:
8+
9+
<TableOfContents
10+
ignoreIds={["usage-with-custom-error-boundaries", "next-steps"]}
11+
/>
812

913
## Usage with `createBrowserRouter` or `createMemoryRouter`
1014

@@ -148,9 +152,11 @@ ReactDOM.render(
148152

149153
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.
150154

151-
## Custom Error Boundaries
155+
## Usage With Custom Error Boundaries
152156

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.
154160

155161
<Alert>
156162
This only applies to render method and lifecycle errors since React doesn't

docs/platforms/javascript/guides/react/features/react-router/v7.mdx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ sidebar_order: 10
99
the docs [here](/platforms/javascript/guides/react-router/).
1010
</Alert>
1111
Apply the following setup steps based on your routing method and create a
12-
[custom error boundary](#custom-error-boundaries) to make sure Sentry
13-
automatically captures rendering errors.
12+
[custom error boundary](#usage-with-custom-error-boundaries) to make sure Sentry
13+
automatically captures rendering errors:
14+
15+
<TableOfContents
16+
ignoreIds={["usage-with-custom-error-boundaries", "next-steps"]}
17+
/>
1418

1519
## Usage with `createBrowserRouter` or `createMemoryRouter`
1620

@@ -152,9 +156,11 @@ ReactDOM.render(
152156

153157
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.
154158

155-
## Custom Error Boundaries
159+
## Usage With Custom Error Boundaries
156160

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.
158164

159165
<Alert>
160166
Note, that this only applies to render method and lifecycle errors since React

0 commit comments

Comments
 (0)