Skip to content
Advertisement

Trying to fetch API via axios, but don’t know how to access

I try to fetch some data from an API. The API is formatted like this:

JavaScript

And in react my app.js looks like this:

JavaScript

And the ItemsGrid:

JavaScript

So nothing is to see beacause I don’t know how to access the array. In the console log I see there is something:

JavaScript

Anyone know how to show the names via mapping?

Advertisement

Answer

If you want to turn the array with an object into a regular array you can use Object.values on the first element of the array:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement