React CollectionView

The second view we will define is the view that will be used to render the entire ClickableItemArray. As mentioned earlier, React is similar to Backbone, in that we will define a view for every individual array item (ItemView), and then another view for the whole collection. This view will be named ItemCollectionView, and will use two interfaces as follows:

export interface IClickableItem { 
    Id: number; 
    DisplayName: string; 
} 
 
export interface IItemCollectionViewProps { 
    title: string, 
    items: IClickableItem[], 
    SelectedItem: IClickableItem; 
}; 

Here, we have defined an interface for each of our array items named IClickableItem that has the Id and DisplayName properties. Our second interface is named IItemCollectionViewProps ...

Get Mastering TypeScript 3 - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.