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
docs(js): React Quick Start guide for Tracing (#13186)
* React Quick Start guide for Error Monitoring feature only
* update section on error boundary
* make Step 4 optional
* update React QS guide for Tracing
* merge with error monitoring and fine-tune
Copy file name to clipboardExpand all lines: docs/platforms/javascript/guides/react/index.mdx
+42-22Lines changed: 42 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,34 +50,20 @@ pnpm add @sentry/react
50
50
51
51
## Step 2: Configure
52
52
53
-
Sentry supports multiple versions of React Router. To learn how to configure them, read the <PlatformLinkto="/configuration/integrations/react-router/">React Router Integration</PlatformLink> docs.
54
-
55
53
### Initialize the Sentry SDK
56
54
57
55
To import and initialize Sentry, create a file in your project's root directory, for example, `instrument.js`, and add the following code:
@@ -160,9 +146,14 @@ import * as Sentry from "@sentry/react";
160
146
</Alert>
161
147
162
148
<OnboardingOptionoptionId="performance">
163
-
## Step 4: Set Up React Router (Optional)
149
+
## Step 4: Set Up React Router
150
+
If you're using `react-router` in your application, you need to set up the Sentry integration for your specific React Router version to trace `navigation` events.\
151
+
Select your React Router version to start instrumenting your routing:
164
152
165
-
The React Router integration is designed to work with our tracing package. Learn more about set up for our [React Router Integration](configuration/integrations/react-router/).
@@ -194,7 +185,9 @@ To capture Redux state data, use `Sentry.createReduxEnhancer` when initializing
194
185
195
186
Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project.
196
187
197
-
Add the following test button to one of your pages, which will trigger an error that Sentry will capture when you click it:
188
+
### Issues
189
+
190
+
To verify that Sentry captures errors and creates issues in your Sentry project, add the following test button to one of your pages, which will trigger an error that Sentry will capture when you click it:
198
191
199
192
```javascript
200
193
<button
@@ -207,10 +200,37 @@ Add the following test button to one of your pages, which will trigger an error
207
200
</button>
208
201
```
209
202
210
-
Open the page in a browser (for most React applications, this will be at localhost) and click the button to trigger a frontend error.
To test your tracing configuration, update the previous code snippet to start a performance trace to measure the time it takes for the execution of your code:
Open the page in a browser (for most React applications, this will be at localhost) and click the button to trigger a frontend error and performance trace.
231
+
232
+
</OnboardingOption>
233
+
214
234
### View Captured Data in Sentry
215
235
216
236
Now, head over to your project on [Sentry.io](https://sentry.io/) to view the collected data (it takes a couple of moments for the data to appear).
0 commit comments