diff --git a/src/platform-includes/getting-started-config/javascript.react.mdx b/src/platform-includes/getting-started-config/javascript.react.mdx index 8d9d02eabe493..8006e60e720b8 100644 --- a/src/platform-includes/getting-started-config/javascript.react.mdx +++ b/src/platform-includes/getting-started-config/javascript.react.mdx @@ -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"; @@ -13,10 +13,9 @@ Sentry.init({ tracesSampleRate: 1.0, }); -ReactDOM.render(, document.getElementById("root")); - -// Can also use with React Concurrent Mode -// ReactDOM.createRoot(document.getElementById('root')).render(); +const container = document.getElementById(“app”); +const root = createRoot(container); +root.render(); ``` Once this is done, all unhandled exceptions are automatically captured by Sentry. diff --git a/src/wizard/javascript/react/index.md b/src/wizard/javascript/react/index.md index f7a07a41adacb..595d0ec3a47b6 100644 --- a/src/wizard/javascript/react/index.md +++ b/src/wizard/javascript/react/index.md @@ -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"; @@ -39,7 +39,7 @@ Sentry.init({ const container = document.getElementById(“app”); const root = createRoot(container); -root.render() +root.render(); ``` > **tracesSampleRate: 1.0** @@ -59,4 +59,4 @@ return ; - [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. \ No newline at end of file +- [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.