Skip to content

Conversation

@berkhoutalex
Copy link

@berkhoutalex berkhoutalex commented Nov 21, 2025

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
image
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
image
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...

  • No code changes (src/ is unmodified: changes to documentation, CI, metadata, etc.)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fixes (non-breaking change which fixes an issue)
  • Improvements (misc. changes to existing features)
  • Features (non-breaking change which adds functionality)

My changes...

  • are breaking changes to a public API (config options, System API, major UI change, etc).
  • are breaking changes to a private API (Redux, component props, utility functions, etc.).
  • are breaking changes to a developer API (npm script behavior changes, new dev system dependencies, etc).
  • are not breaking changes.

Documentation

  • My changes do not require a change to the project documentation.
  • My changes require a change to the project documentation.
  • If yes to above: I have updated the documentation accordingly.

Automated tests

  • My changes can not or do not need to be tested.
  • My changes can and should be tested by unit and/or integration tests.
  • If yes to above: I have added tests to cover my changes.
  • If yes to above: I have taken care to cover edge cases in my tests.
  • All new and existing tests passed.

ReactDOM.createRoot is deprecated in React 19,, it has been ReactDOMClient.createRoot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant