docs: Add FAQ to popconfirm (#48055)

This commit is contained in:
Cooper 2024-03-24 23:06:04 +08:00 committed by GitHub
parent 87debac578
commit a4bf443c01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View File

@ -54,6 +54,12 @@ Consult [Tooltip's documentation](/components/tooltip/#api) to find more APIs.
<ComponentTokenTable component="Popconfirm"></ComponentTokenTable>
## FAQ
### Why does the warning findDOMNode is deprecated some times appear in strict mode?
This is due to the implementation of `rc-trigger`. `rc-trigger` forces children to accept ref, otherwise it will fall back to findDOMNode, so children need to be native html tags. If not, you need to use `React.forwardRef` transparently passes `ref` to native html tags.
## Note
Please ensure that the child node of `Popconfirm` accepts `onMouseEnter`, `onMouseLeave`, `onFocus`, `onClick` events.

View File

@ -55,6 +55,12 @@ demo:
<ComponentTokenTable component="Popconfirm"></ComponentTokenTable>
## FAQ
### 为何在严格模式中有时候会出现 findDOMNode is deprecated 这个警告?
这是由于 `rc-trigger` 的实现方式导致的,`rc-trigger` 强制要求 children 能够接受 ref否则就会 fallback 到 findDOMNode所以 children 需要是原生 html 标签,如果不是,则需要使用 `React.forwardRef``ref` 透传到原生 html 标签。
## 注意
请确保 `Popconfirm` 的子元素能接受 `onMouseEnter`、`onMouseLeave`、`onFocus`、`onClick` 事件。