Skip to content
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

[material-ui][v4] You are importing createRoot from "react-dom" which is not supported. #44983

Open
jay-fleapo opened this issue Jan 9, 2025 · 3 comments
Assignees
Labels
package: material-ui Specific to @mui/material status: waiting for author Issue with insufficient information v4.x

Comments

@jay-fleapo
Copy link

jay-fleapo commented Jan 9, 2025

Steps to reproduce

Description:

I have encountered an issue in the Material-UI package where the findDOMNode function is being imported from "react-dom". This function is not exported from react-dom in the current version of React, leading to an import error.

Details:

File Path: ../../node_modules/.pnpm/@material-ui+core@4.12.4_@types[email protected][email protected][email protected][email protected]/node_modules/@material-ui/core/esm/Unstable_TrapFocus/Unstable_TrapFocus.js
Error Message: Attempted import error: 'findDOMNode' is not exported from 'react-dom' (imported as 'ReactDOM').
Steps to Reproduce:

Install Material-UI version 4.12.4 in a project using React 18.
Attempt to use components that rely on Unstable_TrapFocus.
Observe the import error related to findDOMNode.

Current behavior

The import of findDOMNode from react-dom results in an error, preventing the application from functioning as expected.

Expected behavior

The findDOMNode function should be handled in a way that is compatible with React 18, possibly by avoiding its use or by using alternative methods that do not rely on deprecated APIs.

Context

You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".

@jay-fleapo jay-fleapo added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 9, 2025
@DiegoAndai
Copy link
Member

@jay-fleapo Material UI v4 (@material-ui/core) doesn't support React 18 or 19.

Also, from:

.pnpm/https://github.com/material-ui+core@[4.12.4_@types](mailto:4.12.4_@types)[email protected][email protected][email protected][email protected]

It looks like you have React 19.0.0 installed with mismatching React Types version 18.3.12.

If possible, I would suggest from Material v4 to v5 or even v6. If this is not possible, I would suggest using React 17 and its matching types package.

@DiegoAndai DiegoAndai added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 9, 2025
@DiegoAndai DiegoAndai changed the title You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client". [material-ui][v4] You are importing createRoot from "react-dom" which is not supported. Jan 9, 2025
@DiegoAndai DiegoAndai self-assigned this Jan 9, 2025
@DiegoAndai DiegoAndai added v4.x package: material-ui Specific to @mui/material labels Jan 9, 2025
@jay-fleapo
Copy link
Author

jay-fleapo commented Jan 9, 2025 via email

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Jan 9, 2025
@DiegoAndai
Copy link
Member

DiegoAndai commented Jan 9, 2025

@jay-fleapo you have React 19.0.0 installed with mismatching React Types version 18.3.12. These are not compatible. I don't know how your project is set up, so I don't know how this happened.

I don't recommend using Material UI v4 with React 19, as it's not supported.

@DiegoAndai DiegoAndai added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: material-ui Specific to @mui/material status: waiting for author Issue with insufficient information v4.x
Projects
None yet
Development

No branches or pull requests

2 participants