Reputation: 533
The type of the array of objects looks as follows: MyType: { name: string, age: number }[]
, props type in component is the same
./Parent.jsx
export const Parent = () => {
return (
<Content data={arrOfObj} />
)
}
./Content.jsx
export const Content: React.FC<MyType> = (data) => {...}
Upvotes: 0
Views: 332
Reputation: 24661
This is probably what you wanted
<Content data={arrOfObj} /> // warning
const Content: React.FC<{ data: MyType }> = ({ data }) => {...}
Upvotes: 0