import React from "react"; import SingleEvent from "./SingleEvent"; interface Item { id: string; title: string; description: string; location: string; date: string; image: string; isFeatured: false; } export default function EventList({ items }) { return ( <ul> {items.map((item: Item) => ( <SingleEvent key={item.id} /> ))} </ul> ); } I have this component. Here I destructure the props and get the items array. I do want to define the type of that array.
I tried this
function EventList({ items :Item[]}) But this seems not working and also the items props can be an empty array as well.
How do I achieve this using TS?