element-react
element-react copied to clipboard
开发时告警:Warning: A string ref, "dialog", has been found within a strict mode tree.
Description
然后我翻阅了一下 Dialog 组件的源代码:
怀疑跟这个
ref="dialog"
属性有关
Reproduce Steps
- 安装 react 6.13.1;
- 安装 element-react 1.4.34
- 运行项目就会报warning:
Error Trace (if possible)
Warning: A string ref, "dialog", has been found within a strict mode tree. String refs are a source of potential bugs and should be avoided. We recommend using useRef() or createRef() instead. Learn more about using refs safely here: https://fb.me/react-strict-mode-string-ref
in div (created by Dialog)
in View
in Transition (created by Dialog)
in div (created by Dialog)
in Dialog (at com-bottom-bar.tsx:125)
in div (at com-bottom-bar.tsx:111)
in ComBottomBar (at live.tsx:28)
in div (at live.tsx:26)
in div (at live.tsx:24)
in Live (created by Context.Consumer)
in Route (at App.tsx:18)
in Switch (at App.tsx:15)
in Suspense (at App.tsx:14)
in Router (created by HashRouter)
in HashRouter (at App.tsx:13)
in StrictMode (at App.tsx:12)
in div (at App.tsx:11)
in App (at src/index.tsx:9)
in StrictMode (at src/index.tsx:8)
console.