react版本:18.2
antd版本: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.
试了antd的4.17版本 4.19版本 4.19.5版本 问题都存在
解决:升级到文档上最新4.x版本:4.24.12
就可以了 不报错了
参考:
升级 React18 后 message, notification两个组件会提示警告 · Issue #34823 · ant-design/ant-design · GitHub

在使用react18.2和antd4.19时,由于ReactDOM.render方法已弃用,出现UsecreateRootinstead的错误。升级antd到4.24.12及更高版本,可以消除message和notification组件的警告,这些警告在React18中因使用ReactDOM.render而触发。
4373

被折叠的 条评论
为什么被折叠?



