老师您好,我想问一下SFC和FC有什么区别吗?
来源:3-3 第一个组件 - ts为组件助力

weixin_精慕门9562434
2020-08-13
写回答
1回答
-
张轩
2020-08-14
同学你好 看一下定义源代码就知道
type SFC<P = {}> = FunctionComponent<P>; type FC<P = {}> = FunctionComponent<P>;
这两个是完全一样的,不过第一个上面有一行注释
* @deprecated as of recent React versions, function components can no
* longer be considered 'stateless'. Please use `FunctionComponent` instead.
意思就是 第一个 SFC 在将来要被废弃掉了 使用FC 就好啦
212020-08-14
相似问题