Skip to content

Conversation

@Ad1tya-007
Copy link
Contributor

Fix: Use ReactDOMClient.createRoot instead of outdated API

Summary

Removes webpack warnings by replacing an outdated React API check with the standard ReactDOMClient.createRoot API.

Changes

  • Removed check for ReactDOM.unstable_createRoot (doesn't exist in react-dom)
  • Use ReactDOMClient.createRoot directly (standard API in React 18+)
  • Removed unused ReactDOM import

Problem

Webpack was warning:

export 'unstable_createRoot' (imported as 'ReactDOM') was not found in 'react-dom'

The code was checking for ReactDOM.unstable_createRoot, which doesn't exist in the current version of react-dom.

Solution

Since we're using React 19, we can use ReactDOMClient.createRoot directly, which is the standard API for React 18+.

Testing

  • E2e tests still pass
  • Webpack warnings about unstable_createRoot are eliminated
  • Cleaner build output

This PR now only focuses on fixing the React DOM client API usage.

@mui-bot
Copy link

mui-bot commented Nov 14, 2025

Netlify deploy preview

https://deploy-preview-47252--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 76f0175

@zannager zannager added the internal Behind-the-scenes enhancement. Formerly called “core”. label Nov 14, 2025
@zannager zannager requested a review from mj12albert November 14, 2025 13:56
@mj12albert mj12albert changed the title fix: replace ReactDom.unstable_creatRoot -> ReactDomClient.createRoot [test] Update e2e test app Nov 14, 2025
Signed-off-by: Albert Yu <albert@albertyu.co>
@mj12albert mj12albert merged commit dba6024 into mui:master Nov 14, 2025
18 checks passed
@Ad1tya-007 Ad1tya-007 deleted the fix/e2e-react-dom-client-api branch November 14, 2025 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Behind-the-scenes enhancement. Formerly called “core”. test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants