Reputation: 1389
This is my component:
And there are two errors TypeScript is showing
How can I tell this function that it's going to be passed the children property which will be the JSX element or an array of JSX elements
Upvotes: 1
Views: 4145
Reputation: 4974
Try define your component as FunctionComponent
from react
. It has own children
property:
import React, {FunctionComponent } from 'react';
type Props = ViewProps;
export const Component: FunctionComponent<Props> = (props) => {
return <>
{props.children}
</>;
};
Upvotes: 2