lundi 23 novembre 2020

React passing data from scrollable list of cards to a popup

I have several cards containing data from an array, think of a scrollable list of drivers licenses. When the user clicks on a card I want to pull information from it and create a popup, meaning a popup will show the drivers name and several other bits of information.

Is there a way to pull information from the drivers license within the list and display it in a popup? For example: using event.target.value somehow?

I could technically use a key maybe stored in each drivers license within the scrollable list and then go through the json using .map() a second time. However, I would prefer to be as efficient as possible, as the website is already rendering a lot of information and needs to feel fast.

the scrollable list of cards is a list that uses .map() to go through a json file and print out its contents as each drivers license.

The popup: slightly different looking from the drivers license but uses much of the same data.

I would appreciate it if you could be a bit detailed on the solution, thanks!




Aucun commentaire:

Enregistrer un commentaire