


The map method takes a callback function(a function within a function) and accepts a parameter to use in iterating through the array. The first step is to call the map method on the outermost books array which contains our objects. We want to return only the categories of the books on the shelves. I will be using the following books array of objects to explain how I solved this problem. I wanted to return the names of all the books within the parts array inside the courses array.įinally realized what I was doing wrong and figured that I needed to use two instances of the map function. I spent the last couple of hours trying to figure out how to get to the data in the Parts array within the Courses array of objects inside my react app and googled extensively without finding anything that could help.
