Import createRoot from react-dom/client #10642
Open
+10
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Switches the createRoot import from react-dom to react-dom/client
Motivation and Context
In React 18.0, render was deprecated and replaced by ReactDOMClient.createRoot, but they also had createRoot in just ReactDOM. In React 19.0, they removed ReactDOM.createRoot, which is causing errors with swagger that look like 's is not a function'. When running swagger with React 18.3, it shows this warning "Warning: You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client"." and then react 19.0 crashes

https://react.dev/blog/2024/04/25/react-19-upgrade-guide
Fixes #10511
Fixes #10636
How Has This Been Tested?
Ran the dev server on master with React pinned to 19, and I got

Then on this branch, running the dev server on every working react version (18, 19. The current dependencies do not let you install react earlier than 18) rendered with no isssues
Screenshots (if appropriate):
Checklist
My PR contains...
src/is unmodified: changes to documentation, CI, metadata, etc.)package.json)My changes...
Documentation
Automated tests