Skip to content

Commit 0a9ebd0

Browse files
Jesse-Boxlizokm
andauthored
Chore(wizard)react (#6388)
* [Modified] React Wizard * [Removed] Duplicate Sentence * [Removed] Alert HTML in favor of markdown quote * [Added] Some Markdown line breaks * [Modfied] Configure subtext Co-authored-by: Liza Mock <[email protected]> * [Modfied] tracesSampleRate quote Co-authored-by: Liza Mock <[email protected]> * [Modified] Verify Subtext --------- Co-authored-by: Liza Mock <[email protected]>
1 parent 1c65411 commit 0a9ebd0

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

src/wizard/javascript/react.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ doc_link: https://docs.sentry.io/platforms/javascript/guides/react/
44
support_level: production
55
type: framework
66
---
7+
In this quick guide you’ll set up:
8+
- `@sentry/react` for [error monitoring](https://docs.sentry.io/platforms/javascript/guides/react/)
9+
- `@sentry/tracing` for [performance monitoring](https://docs.sentry.io/platforms/javascript/guides/react/performance/)
710

8-
To instrument your React application with Sentry, first install the `@sentry/react` and `@sentry/tracing` packages:
11+
---
12+
13+
## Install
14+
Sentry captures data by using an SDK within your application’s runtime.
915

1016
```bash
1117
# Using yarn
@@ -15,39 +21,39 @@ yarn add @sentry/react @sentry/tracing
1521
npm install --save @sentry/react @sentry/tracing
1622
```
1723

18-
Next, import and initialize the Sentry module as early as possible, before initializing React:
24+
## Configure
25+
Initialize Sentry as early as possible in your application's lifecycle.
1926

2027
```javascript
21-
import React from "react";
22-
import ReactDOM from "react-dom";
28+
import { createRoot } React from "react-dom/client";
29+
import React from "react";
2330
import * as Sentry from "@sentry/react";
2431
import { BrowserTracing } from "@sentry/tracing";
2532
import App from "./App";
2633

2734
Sentry.init({
2835
dsn: "___PUBLIC_DSN___",
2936
integrations: [new BrowserTracing()],
30-
31-
// Set tracesSampleRate to 1.0 to capture 100%
32-
// of transactions for performance monitoring.
33-
// We recommend adjusting this value in production
3437
tracesSampleRate: 1.0,
3538
});
3639

37-
ReactDOM.render(<App />, document.getElementById("root"));
38-
39-
// Can also use with React Concurrent Mode
40-
// ReactDOM.createRoot(document.getElementById('root')).render(<App />);
40+
const container = document.getElementById(“app”);
41+
const root = createRoot(container);
42+
root.render(<App />)
4143
```
4244

43-
The above configuration captures both error and performance data. To reduce the volume of performance data captured, change `tracesSampleRate` to a value between 0 and 1.
44-
45-
After this step, Sentry will report any uncaught exceptions triggered by your application.
45+
> **tracesSampleRate: 1.0**
46+
> The above setting ensures that 100% of transactions will be sent to Sentry, but we recommend lowering this number in production.
4647
47-
You can trigger your first event from your development environment by raising an exception somewhere within your application. An example of this would be rendering a button whose `onClick` handler attempts to invoke a method that does not exist:
48+
## Verify
49+
This snippet contains an intentional error and can be used as a test to make sure that everything's working as expected.
4850

4951
```javascript
5052
return <button onClick={() => methodDoesNotExist()}>Break the world</button>;
5153
```
5254

53-
Once you've verified the library is initialized properly and sent a test event, consider visiting our [complete React docs](https://docs.sentry.io/platforms/javascript/guides/react/). There you'll find additional instructions for surfacing valuable context from React error boundaries, React Router, Redux, and more.
55+
---
56+
## Next Steps
57+
- [Source Maps](https://docs.sentry.io/platforms/javascript/guides/react/sourcemaps/): Learn how to enable readable stack traces in your Sentry errors.
58+
- [React Features](https://docs.sentry.io/platforms/javascript/guides/react/features/): Learn about our first class integration with the React framework.
59+
- [Session Replay](https://docs.sentry.io/platforms/javascript/guides/react/session-replay/): Get to the root cause of an error or latency issue faster by seeing all the technical details related to that issue in one visual replay on your web application.

0 commit comments

Comments
 (0)