How do I make this component using function instead of const?
const MyComponent: React.FC = () => {
return <div>My Component</div>;
}
I tried doing this
function MyComponent (): React.FC {
return <div>My Component</div>;
}
However, my editor is highlighting the return statement and giving this error:
Type 'Element' is not assignable to type 'FC<{}>'. Type 'ReactElement<any, any>' provides no match for the signature '(props: { children?: ReactNode; }, context?: any): ReactElement<any, any> | null'.ts