'Function as property in React.js + TypeScript component
What are the differences between this syntax? What types will they have?
eg:
const foo = () => (<>Something...</>);
const bar = (arg: string) => (<>{arg}</>);
interface IComponent {
property: ???
}
<Component property={foo} />
<Component property={foo()} />
<Component property={() => foo} />
<Component property={() => foo()} />
<Component property={() => bar(arg)} />
<Component property={bar(arg)} />
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
