【发布时间】:2019-05-21 23:56:12
【问题描述】:
我用这样声明无状态组件:
const example: React.SFC<IExample> = ({propsType}) => ();
但是 SFC 现在已被弃用,也许 this twitter post from Dan Abramov 解释了原因。
既然 SFC 已被弃用,我们应该使用什么?
【问题讨论】:
-
有趣的是,
SFC已被弃用,但StatelessComponent不是。但是,正如@Doğancan Arabacı 所说,应该使用FunctionComponent。
标签: reactjs typescript deprecated deprecation-warning