我有以下内容:
arrayOfObjects.map((arrayItem,index) => {
let key = "place_" + (index + 1); // generate the key to access an object from 'countrydata'. If we are at the first object (index == 0),the key will be "place_1"
return (
<div>
<img src={countrydata[key].image_location}/> // access the matching object from 'countrydata' and use it
<span>{arrayItem.name}</span> // access the current array item from 'arrayOfObjects'
</div>
);
})
调用所有这些函数并为extractArrVals函数使用第二个参数的最佳方法是什么(请参见我的示例),以便可以使用https://www.30secondsofcode.org/snippet/compose?