你可以使用下面的代码在TypeScript中定义React函数组件的类型:
export const Component: React.FC = () => {
return // Stuff
};
如何对非箭头函数执行相同操作?
function Component() {
return // Stuff
}
有什么实践上的区别吗?这份流行的速查表没有涵盖它,所以我想知道是否有不使用该语法的原因?
https://github.com/typescript-cheatsheets/react-typescript-cheatsheet