lundi 13 janvier 2020

How to display a single object chosen at random from an array held in state

I need to display a single object from inside an array chosen at random. I would usually use .map to display the array out, but instead of displaying the full array, I need to display 1 item at a time, then use a button to cycle through the array objects displayed at random.

Could I get anyone to point me in the right direction? Looking for a solution in javascript for my react app.

Thank you!




Aucun commentaire:

Enregistrer un commentaire