tea-design / tea-component

37 stars 6 forks source link

Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17 #23

Open Encorehwang opened 1 year ago

Encorehwang commented 1 year ago

Describe the bug 我的项目中使用了tea-component,有个页面的逻辑是当点击某个按钮时通过Modal.confirm弹出确认框,每次当我点击按钮时浏览器控制台都会报这样的错误:

react_devtools_backend.js:4012 Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot

查阅了相关资料后,了解到我们项目中用的React是18版本的,在React 18以上的版本中已经不支持ReactDOM.render这个语法了,但Modal组件在创建组件实例时一些底层的逻辑还是用到了相关方法,这里是否可以升级下创建组件实例的方式?

System Info

System:
  OS: Windows 10 专业版 64-bit
  CPU: Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
  Memory: 32768MB RAM

Binaries:
  Node: 16.12.0
  Yarn: 1.18.0
  npm: 8.1.0

Browsers:
  Chrome: 108.0.5359.126(正式版本)

npmPackages:
  "react": "^18.2.0",
  "react-dom": "^18.2.0",
  "react-final-form-hooks": "^2.0.2",
  "react-redux": "^8.0.5",
  "react-sortable-hoc": "^2.0.0",
  "tea-component": "^2.7.8",
xughv commented 1 year ago

我们在升级 React18 的过程中遇到了一些底层依赖库的其他问题,整体支持 React18 的版本应该要晚些时候才会有。

liukai3586 commented 1 year ago

其 请问啥时候会开源呀