我想改变这个匿名。功能
const Button: React.FunctionComponent = ({ children }: Props) => { })
函数签名
function Button() { }
但是如何在函数版本上插入类型 React.FunctionComponent
?
答案 0 :(得分:1)
你可以这样写:
interface DummyProps{
property1:string //here instead of property1 you can name it whatever you want to and its type can be anything.For example i have used here string
}
export default ({property1}:DummyProps) => {
return (
<div>
{property1}
</div>
);
}