I have a response like this:
I want to display the name of each object inside this HTML:
{subjects.map((item, i) => (
Do you get an error when you try to map through the object keys, or does it throw something else.
Also note when you want to map through the keys you make sure to refer to the object keys correctly. Just like this:
{ Object.keys(subjects).map((item, i) => (
-
key: {i} Name: {subjects[item]}
))}
You need to use {subjects[item]}
instead of {subjects[i]}
because it refers to the keys of the object. If you look for subjects[i] you will get undefined.