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

使用了已废弃的 findDOMNode 方法。React 提示这个API将在未来的重大版本中被移除,并推荐直接在需要引用的元素上添加一个 ref 来替代。 #2672

Open
1 task
renjiali opened this issue May 8, 2024 · 1 comment

Comments

@renjiali
Copy link

renjiali commented May 8, 2024

Basic Info

  • Package Name And Version: @arco-design/web-react@2.62.0
  • Browser: chrome124.0.0.0
  • Reproduction Link: https://codepen.io/

Extra info

chunk-XXFZAZRP.js?v=9034e8aa:519 Warning: findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node
at ResizeObserverComponent2 (http://localhost:5173/node_modules/.vite/deps/@arco-design_web-react.js?t=1715171400913&v=8ebafdb4:9449:45)
at Trigger2 (http://localhost:5173/node_modules/.vite/deps/@arco-design_web-react.js?t=1715171400913&v=8ebafdb4:12149:26)
at Dropdown (http://localhost:5173/node_modules/.vite/deps/@arco-design_web-react.js?t=1715171400913&v=8ebafdb4:17349:42)
at SubMenuPop (http://localhost:5173/node_modules/.vite/deps/@arco-design_web-react.js?t=1715171400913&v=8ebafdb4:18207:20)
at SubMenu (http://localhost:5173/node_modules/.vite/deps/@arco-design_web-react.js?t=1715171400913&v=8ebafdb4:18268:25)
at div
at ResizeObserverComponent2 (http://localhost:5173/node_modules/.vite/deps/@arco-design_web-react.js?t=1715171400913&v=8ebafdb4:9449:45)
at OverflowWrap (http://localhost:5173/node_modules/.vite/deps/@arco-design_web-react.js?t=1715171400913&v=8ebafdb4:18364:25)
at div
at div
at Menu (http://localhost:5173/node_modules/.vite/deps/@arco-design_web-react.js?t=1715171400913&v=8ebafdb4:20234:43)
at HeaderComponent (http://localhost:5173/src/layout/Header.tsx?t=1715171670301:15:22)
at header
at Header (http://localhost:5173/node_modules/.vite/deps/@arco-design_web-react.js?t=1715171400913&v=8ebafdb4:19868:53)
at section
at Layout (http://localhost:5173/node_modules/.vite/deps/@arco-design_web-react.js?t=1715171400913&v=8ebafdb4:20011:43)
at Component
at RenderedRoute (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=fc2972eb:3651:5)
at RenderErrorBoundary (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=fc2972eb:3611:5)
at DataRoutes (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=fc2972eb:4764:5)
at Router (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=fc2972eb:4029:15)
at RouterProvider (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=fc2972eb:4581:5)
at ParallaxProvider (http://localhost:5173/node_modules/.vite/deps/react-scroll-parallax.js?v=3a8a4ac3:1317:44)

What is expected?

问题在于代码中使用了已废弃的 findDOMNode 方法。React 提示这个API将在未来的重大版本中被移除,并推荐直接在需要引用的元素上添加一个 ref 来替代。

根据错误信息,这个警告来源于 @arco-design/web-react 库中的某些组件,特别是 ResizeObserverComponent2。这表明Arco Design UI库内部可能还在使用 findDOMNode,而你的应用通过导入和使用这些组件间接触发了该警告。

在你自己的代码示例中,虽然没有直接使用 findDOMNode,但因为引入了 @arco-design/web-react 的组件(如 Menu, Layout),这些组件内部可能还在使用过时的方法。

Steps to reproduce

不需要复现

@yinkaihui
Copy link
Contributor

#2540

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants