I've got 2 objects:
const bag = { eth: 50, btc: 30, kla: 10, set: 5, ova: 5 };
const assetList = {
eth: {
name: "Ethereum",
icon: "urlhere",
colour: "#030",
text: "light",
},
btc: {
name: "Bitcoin",
icon: "urlhere",
colour: "#000",
text: "dark",
},
};
Now I would like to end up with:
<ul>
{Object.keys(bag).map(function (asset, keyIndex) {
return (
<li>
{assetList[asset].name}
</li>
);
})}
</ul>
I'm trying to approach this as I would in python, but this clearly doesn't work. How can I get the name of the responding assets here?
bagthat aren't in yourassetList. You're not using anything inbagother than the keys so why not map through the keys/values ofassetListinstead>