Skip to content

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

@jay-fleapo

Description

@jay-fleapo

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+react@18.3.12_react-dom@19.0.0_react@19.0.0__react@19.0.0/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".

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions