I want to open a popup after click on each card and show information of that card on popup but I can not get key to know index to choose information to show
const childElements = this.state.images.map(function (item, i) {
return (
<div key={item.id} data-key={i}>
<MediaCard
poster={item.largeImageURL}
id={item.id}
views={item.views}
key={item.id}
data-key={i}
/>
</div>
);
});
I have to define index array to choose the right object to show on popup
<StackGrid
onClick={this.openModal}
>
{childElements}
</StackGrid>
{this.state.visible ? (
<Popup id={this.state.images['I want to know index after click each card to insert heare'].id} handler={this.handler} />
) : null}
onClickevent fromMediaCard?iononClickevent? You know, we get the index of object inmap.