React – state

I’m reviewing React state management, which I still find a bit confusing.  This exercise comes from Colt Steele’s Advanced Coding Bootcamp on Udemy.  The goal of this exercise is to list four instructors and their hobbies, and with a setTimeout of 5000ms, randomly remove one of the instructor’s hobbies.  I randomly generate a number of one of the instructors on line 26.  On line 29, I use the map function to loop through the array.  When it comes to the randomly selected instructor, I randomly choose a hobby to remove.  On line 40, I use setState to update the display.

 

Leave a Reply

Your email address will not be published. Required fields are marked *