Skip to content

Update React examples to React 18 #6542

@AbhiPrasad

Description

@AbhiPrasad

Core or SDK?

Platform/SDK

Which part? Which one?

@sentry/react

Description

@AbhiPrasad since React 18, there's a updated method of importing react.

I took this from the official react website

import { createRoot } from 'react-dom/client';

// Clear the existing HTML content
document.body.innerHTML = '<div id="app"></div>';

// Render your React component instead
const root = createRoot(document.getElementById('app'));
root.render(<h1>Hello, world</h1>);

Originally posted by @Jesse-Box in #6508 (comment)

Suggested Solution

Change everywhere we need to change

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions