chupapee
chupapee

Reputation: 533

Type X is not assignable to type 'IntrinsicAttributes & Y'

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

Answers (1)

Konrad
Konrad

Reputation: 24661

This is probably what you wanted

<Content data={arrOfObj} /> // warning

const Content: React.FC<{ data: MyType }> = ({ data }) => {...}

Upvotes: 0

Related Questions