React中使用antd-mobile组件库中的跑马灯组件报错严格模式问题

A string ref, "slider", 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-mod

使用antd-mobile的跑马灯组件报错

index.js:1 Warning: A string ref, "slider", 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
index.js:1 Warning: A string ref, "frame", 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

根据提示我们找到:React严格模式

根据以上信息,找到项目src目录中的index.js,删除掉该 <React.StrictMode>标签即可。

  • 1.本站主要是为了记录工作、学习中遇到的问题,可能由于本人技术有限,有些不正确的地方,仅供参考。
  • 2.本站中会转载我认为有用的博客文章,添加一些外链网站地址,但这些博客文章、论坛和网站上的内容和我没有关系,不代表我的意见,请网友自己多注意辨别。
  • 3.本站中转载文章会写明来源(点击下方链接按钮即可),感谢原作者的辛苦写作,如果有异议,及时联系我处理,谢谢!
  • 4.欢迎指出有问题的地方,我会尽快修正,谢谢!

系统由 Nginx + Next.js + React + Node + TailWindCss 驱动

沪ICP备20021316号