React 18 uses antd's message and notification components to report an error createRoot warning

react-version: 18.2

antd version: 4.19

报错:Use createRoot instead" occurs because the ReactDOM.render method has been deprecated. To solve the error, create a root element and use the ReactDOMClient.render method instead. This occurs since the render () method of the react-dom package is considered legacy starting react-dom version 18.

Tried version 4.17 of antd, version 4.19, version 4.19.5, the problem exists

Solution: Upgrade to the latest 4.x version on the document: 4.24.12

That's it, don't report an error

reference:

After upgrading React18, message and notification will prompt a warning · Issue #34823 · ant-design/ant-design · GitHub

fix: Notification & message throw `createRoot` warning in React 18 by zombieJ · Pull Request #35030 · ant-design/ant-design · GitHub

fix: React 18 use createRoot instead by zombieJ · Pull Request #203 · react-component/notification · GitHub

Guess you like

Origin blog.csdn.net/csdn1940879828/article/details/132019536