Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
```javascript
import { createRoot } from "react-dom/client";
import React from "react";
import ReactDOM from "react-dom";
import * as Sentry from "@sentry/react";
import App from "./App";

Expand All @@ -13,10 +13,9 @@ Sentry.init({
tracesSampleRate: 1.0,
});

ReactDOM.render(<App />, document.getElementById("root"));

// Can also use with React Concurrent Mode
// ReactDOM.createRoot(document.getElementById('root')).render(<App />);
const container = document.getElementById(“app”);
const root = createRoot(container);
root.render(<App />);
```

Once this is done, all unhandled exceptions are automatically captured by Sentry.
Expand Down
6 changes: 3 additions & 3 deletions src/wizard/javascript/react/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ npm install --save @sentry/react
Initialize Sentry as early as possible in your application's lifecycle.

```javascript
import { createRoot } React from "react-dom/client";
import { createRoot } from "react-dom/client";
import React from "react";
import * as Sentry from "@sentry/react";
import App from "./App";
Expand All @@ -39,7 +39,7 @@ Sentry.init({

const container = document.getElementById(“app”);
const root = createRoot(container);
root.render(<App />)
root.render(<App />);
```

> **tracesSampleRate: 1.0**
Expand All @@ -59,4 +59,4 @@ return <button onClick={() => methodDoesNotExist()}>Break the world</button>;

- [Source Maps](https://docs.sentry.io/platforms/javascript/guides/react/sourcemaps/): Learn how to enable readable stack traces in your Sentry errors.
- [React Features](https://docs.sentry.io/platforms/javascript/guides/react/features/): Learn about our first class integration with the React framework.
- [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.
- [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.