当前位置:网站首页>类型“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 )
就一切正常了嘿
边栏推荐
- 检查点是否在矩形内
- Use Jenkins for continuous integration, this knowledge point must be mastered
- 计算两点之间的中点
- Chapter 19 Tips and Traps: Common Goofs for Novices
- 加载字体时避免隐藏文本
- 仿牛客网项目第三章:开发社区核心功能(详细步骤和思路)
- Building a cloud-native DevOps environment
- [C language advanced] file operation (2)
- PDF转Word有那么难吗?做一个文件转换器,都解决了
- 6134. 找到离给定两个节点最近的节点-力扣双百代码
猜你喜欢

20220725资料更新

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

GIF制作-灰常简单的一键动图工具

Get piggy homestay (short-term rental) data

经典文献阅读之--DLO

月薪12K,蝶变向新,勇往直前—她通过转行测试实现月薪翻倍~

Making a Simple 3D Renderer

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

论文理解【RL - Exp Replay】—— Experience Replay with Likelihood-free Importance Weights

Access the selected node in the console
随机推荐
Flink学习第三天——一文带你了解什么是Flink流?
架构基本概念和架构本质
color transparency parameter
UML diagram of soft skills
基于JAX的激活函数、softmax函数和交叉熵函数
cmd指令
【参营经历贴】2022网安夏令营
PostgreSQL Basics--Common Commands
D - Linear Probing- 并查集
Special characters & escapes in bat
C#大型互联网平台管理框架源码:基于ASP.NET MVC+EF6+Bootstrap开发,支持多数据库
20220725资料更新
Avoid , ,
, and tags月薪12K,蝶变向新,勇往直前—她通过转行测试实现月薪翻倍~
Sql之各种Join
How do programmers solve online problems gracefully?
Additional Features for Scripting
Check if point is inside rectangle
[Camp Experience Post] 2022 Cybersecurity Summer Camp
请问什么是 CICD