Giter VIP home page Giter VIP logo

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: about pro-components HOT 7 OPEN

yangjike123 avatar yangjike123 commented on August 20, 2024
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:

from pro-components.

Comments (7)

fnoopv avatar fnoopv commented on August 20, 2024

ref #8382

from pro-components.

yangjike123 avatar yangjike123 commented on August 20, 2024

你好,有修复这个问题的计划吗?或者是有可以手动去解决 @fnoopv

from pro-components.

fnoopv avatar fnoopv commented on August 20, 2024

你好,有修复这个问题的计划吗?或者是有可以手动去解决 @fnoopv

rc-util库的问题,只能等他们修,别的没办法

from pro-components.

tangbzai avatar tangbzai commented on August 20, 2024

貌似Tooltip的children渲染为null时会出现该警告#48709
这种情况可以在这个库使用Tooltip时避免

from pro-components.

ByteTerminator avatar ByteTerminator commented on August 20, 2024

"antd": "4.24.15",
"react": "18.2.0",
"react-dom": "18.2.0",
锁版本解决了这个问题,node16.20.2 npm8.19.4

from pro-components.

tangbzai avatar tangbzai commented on August 20, 2024

貌似Tooltip的children渲染为null时会出现该警告#48709 这种情况可以在这个库使用Tooltip时避免

ant-design官方文档的解释

为何在严格模式中有时候会出现 findDOMNode is deprecated 这个警告?
这是由于 rc-trigger 的实现方式导致的,rc-trigger 强制要求 children 能够接受 ref,否则就会 fallback 到 findDOMNode,所以 children 需要是原生 html 标签,如果不是,则需要使用 React.forwardRef 把 ref 透传到原生 html 标签。

另外我在使用 umi-plugin-layout 的菜单也出现了这个问题
导致问题的代码位置

umi-plugin-layoutmenuItemRender 返回了一个 umiLink组件 代码位置
然后 pro-componentsMenuItemTooltip 直接用 Tooltip 包住了返回的 Link 组件 代码位置

上述代码导致 Tooltip 直接包住了一个不能够接受 refLink,所以出现了这个问题

可能的改进办法
  1. MenuItemTooltipprops.children外包一层可接受 ref 的标签
  2. umi-plugin-layoutmenuItemRender返回的 Link 组件外包一层可接受 ref 的标签
* 因为这个问题涉及到两个库,我不太确定应该在哪边改,应该只需要修改一个地方就能解决这个问题

from pro-components.

Jackwew avatar Jackwew commented on August 20, 2024

"antd": "4.24.15", "react": "18.2.0", "react-dom": "18.2.0", 锁版本解决了这个问题,node16.20.2 npm8.19.4

这个不是pro-components的错误么,你锁了antd的版本就没问题了?

from pro-components.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.