简体   繁体   English

使用 Ant 设计组件时升级到 React 版本 16.10.2 错误。 Function 元件不能给出参考

[英]Upgrade to React version 16.10.2 error while using Ant Design Components. Function components cannot be given refs

I recently upgraded to React version 16.10.2 .我最近升级到React version 16.10.2 And facing errors while using And Design Components.并在使用 And Design Components 时遇到错误

I want to use Title from Typography.我想使用排版中的标题。 Here is what I was doing earlier.这是我之前所做的。

import { Typography } from 'antd'
const { Title } = Typography 

<Title level={4}>Hello World</Title>

I have an error in console as follows我在console中有如下错误

Function components cannot be given refs. Function 组件不能给出参考。 Attempts to access this ref will fail.尝试访问此 ref 将失败。 Did you mean to use React.forwardRef()?你的意思是使用 React.forwardRef() 吗?

This issue has been fixed in antd@3.23.6: https://github.com/ant-design/ant-design/pull/19074此问题已在 antd@3.23.6 中修复: https://github.com/ant-design/ant-design/pull/19074

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用 React Beautiful DND 为函数组件提供引用 - Function components cannot be given refs with React Beautiful DND 无状态函数组件不能给出refs - Stateless function components cannot be given refs 警告:函数组件不能被赋予 refs - Warning: Function components cannot be given refs 理解:警告:Function 组件不能给出参考 - Understanding: Warning: Function components cannot be given refs 在 2 个反应组件中使用相同的功能。 第二个不起作用 - Using same function in 2 react components. Second doesnt work 错误:Function 组件不能有参考。? - Error : Function components cannot have refs.? React ref for a function 组件,无法获取引用:“Function components cannot be given refs” - React ref for a function component, unable to acquire a reference: “Function components cannot be given refs” “无状态功能组件不能给出参考”是什么意思? - What does “Stateless function components cannot be given refs” mean? 对子组件使用 refs 做出反应 - React using refs for child components 如何摆脱错误功能组件不能被赋予参考。 尝试访问此 ref 将失败。 你的意思是使用 React.forwardRef() 吗? - How to get rid off error Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM