当前位置:网站首页>类型“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 )
就一切正常了嘿
边栏推荐
猜你喜欢
cmd command
访问控制台中的选定节点
解决端口占用
The monthly salary of the test post is 5-9k, how to increase the salary to 25k?
【参营经历贴】2022网安夏令营
在CDH的hue上的oozie出现,提交 Coordinator My Schedule 时出错
[email protected]与
YOLO等目标检测模型的非极大值抑制NMS和评价指标(Acc, Precision, Recall, AP, mAP, RoI)、YOLOv5中[email protected]与
drf生成序列化类代码
Flink学习第三天——一文带你了解什么是Flink流?
A brief analysis of mobile APP security testing in software testing, shared by a third-party software testing agency in Beijing
随机推荐
PDF转Word有那么难吗?做一个文件转换器,都解决了
Secondary Vocational Network Security Competition B7 Competition Deployment Process
GIF制作-灰常简单的一键动图工具
加载字体时避免隐藏文本
Flink学习第三天——一文带你了解什么是Flink流?
CF1705D Mark and Lightbulbs
切面打印调取的方法
CAKE:一个用于多视图知识图谱补全的可扩展性常识感知框架
Deep Learning Fundamentals - Numpy-based Recurrent Neural Network (RNN) implementation and backpropagation training
Nacos配置中心之加载配置
Oracle 数据库设置为只读及读写
Flink学习第四天——完成第一个Flink 流批一体案例
访问控制台中的选定节点
C语言——分支语句和循环语句
Check if point is inside rectangle
Quartus 使用 tcl 文件快速配置管脚
PostgreSQL 基础--常用命令
FAST-LIO2 code analysis (2)
Use Jenkins for continuous integration, this knowledge point must be mastered
numpy.around