I looked at some other answers on stackoverflow and haven't been able to find one that answers my question.
I havea a variable toolShortcuts that is an object made up of arrays of objects:
toolShortcuts = {
1: [{key: "s", description: "click this to scale"}],
2: [{key: "delete", description: "click this to delete"}, {key: "backspace",description: "click this to delete"}]
}
I'm trying to return some HTML for every element in the object (3 elements in the above object). Since I'm using a for loop with a return statement, only the first elements of each array are being displayed (2 out of the 3 elements). How can I display all three elements?
<Container>
{ Object.values(toolShortcuts).map((shortcuts) => {
for (let i in shortcuts) {
return (
<Row>
<$DescriptionCol>{shortcuts[i].description}</$DescriptionCol>
<$ButtonCol lg="3">{shortcuts[i].key}</$ButtonCol>
</Row>
)
}
})
}
</Container>