当前位置:网站首页>类型“FC<Props>”的参数不能赋给类型“ForwardRefRenderFunction<unknown, Props>”的参数。 属性“defaultProps”的类型不兼容。 不
类型“FC<Props>”的参数不能赋给类型“ForwardRefRenderFunction<unknown, Props>”的参数。 属性“defaultProps”的类型不兼容。 不
2022-08-01 23:41:00 【一麻袋小猫】
场景:react+ts 父子组件皆为无状态函数式组件,子组件使用了React.forward
报错:类型“FC”的参数不能赋给类型“ForwardRefRenderFunction<unknown, Props>”的参数。
属性“defaultProps”的类型不兼容。
不能将类型“Partial | undefined”分配给类型“undefined”。
不能将类型“Partial”分配给类型“undefined”
原因:报错写的很清晰了,FC与React.Forward不能同时使用
解决:这时就用普通函数组件定义方式
const MenuEditView = (props: Props, ref: any):any => {
}
export default Reacr.Forward(MenuEditView )
就一切正常了嘿
边栏推荐
- 高效工作文档产出归类
- UML diagram of soft skills
- Calculate the distance between two points
- Chapter 12 End-User Task As Shell Scripts
- 基于JAX的激活函数、softmax函数和交叉熵函数
- Chapter 11 Working with Dates and Times
- GIF制作-灰常简单的一键动图工具
- 计算两点之间的距离
- 【C语言进阶】文件操作(二)
- 6134. Find the closest node to the given two nodes - force double hundred code
猜你喜欢

使用Jenkins做持续集成,这个知识点必须要掌握

Making a Simple 3D Renderer

Work for 5 years, test case design is bad?To look at the big case design summary

UML diagram of soft skills

深度学习基础-基于Numpy的循环神经网络(RNN)实现和反向传播训练

分享10套开源免费的高品质源码,免费源码下载平台

PDF转Word有那么难吗?做一个文件转换器,都解决了
Background project Express-Mysql-Vue3-TS-Pinia page layout-sidebar menu

企业防护墙管理,有什么防火墙管理工具?

cdh6打开oozieWeb页面,Oozie web console is disabled.
随机推荐
LocalDateTime转为Date类型
计算两点之间的中点
请问什么是 CICD
Department project source code sharing
程序员还差对象?new一个就行了
Use Jenkins for continuous integration, this knowledge point must be mastered
Calculate the angle of a line defined by two points
E - Integer Sequence Fair
qt-faststart installation and use
sys_kill system call
Calculate the midpoint between two points
numpy.isclose
Oracle database is set to read-only and read-write
Jmeter是什么
Avoid , ,
, and tagsIDEA常用插件
Get piggy homestay (short-term rental) data
ICLR 2022 Best Paper: Partial Label Learning Based on Contrastive Disambiguation
Secondary Vocational Network Security Competition B7 Competition Deployment Process
分享10套开源免费的高品质源码,免费源码下载平台