-
Notifications
You must be signed in to change notification settings - Fork 7.3k
fix: replace ReactDOM.render with createRoot for React 18 compatibility #16292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Hi, thanks for your contribution! |
dc65a41
to
4007da6
Compare
ReactDOM.unmountComponentAtNode(presenceLabelContainer); | ||
if (this._presenceLabelRoot) { | ||
this._presenceLabelRoot.unmount(); | ||
delete this._presenceLabelRoot; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just set it to undefined pl
); | ||
}); | ||
|
||
// No need to unmount with ReactDOM.render in this context, so this can be removed or left empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we need to unmount here?
react/index.web.js
Outdated
ReactDOM.render( | ||
<Component { ...props } />, | ||
document.getElementById(elementId) | ||
const root = createRoot(document.getElementById(elementId)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the root be stored somewhere?
Jenkins please test this please. |
5ed0cb2
to
f16eeb5
Compare
Fix Lint FIx Lint
f16eeb5
to
3d9f6cc
Compare
Jenkins please test this please. |
1 similar comment
Jenkins please test this please. |
Summary
This PR replaces deprecated usage of
ReactDOM.render
withReactDOM.createRoot
to make the app compatible with React 18.Why
React 18 no longer supports
ReactDOM.render
. Continuing to use it causes the following warning:What Changed
ReactDOM.render(...)
to useReactDOM.createRoot(...)
root.unmount()
where needed