I'm trying to access the all of the items in the JSON object below
{
"Member1": {
"name": "",
"position": "",
"photoPath": ""
},
"Member2": {
"name": "",
"position": "",
"photoPath": ""
},
"Member3": {
"name": "",
"position": "",
"photoPath": ""
},
"Member4": {
"name": "",
"position": "",
"photoPath": ""
}
}
How would I go about looping through each member for their attributes for use in another object using the map()
function?
This is what I have so far: I also just throw in variable into the JSX using brackets
var List = JSONObj.map((Member) => {
return (
<MemberComponent
name={Member.name}
</MemberComponent>
);
});
Edit: Object.values.map() did it! Thanks for your help