Javascript 映射到道具时,在react中丢失键值对

Javascript 映射到道具时,在react中丢失键值对,javascript,reactjs,data-binding,promise,axios,Javascript,Reactjs,Data Binding,Promise,Axios,在对一个API发出多个请求后,我promise.all()会发出该请求并发出另一个请求,同时保留上一个请求中的一些属性。这给了我: (4) [{…}, {…}, {…}, {…}] 0: {product_id: "2", results: Array(4), productInfo: {…}} 1: {product_id: "3", results: Array(6), productInfo: {…}} 2: {product_id: "8

在对一个API发出多个请求后,我
promise.all()
会发出该请求并发出另一个请求,同时保留上一个请求中的一些属性。这给了我:

(4) [{…}, {…}, {…}, {…}]
0: {product_id: "2", results: Array(4), productInfo: {…}}
1: {product_id: "3", results: Array(6), productInfo: {…}}
2: {product_id: "8", results: Array(9), productInfo: {…}}
3: {product_id: "7", results: Array(5), productInfo: {…}}
length: 4
__proto__: Array(0)
productInfo:{…}
是我想要的键值对。在底部的这个组件中,I
console.log()
对象出现了,但是它在
map()中丢失了。
?这是为什么?我如何解决这个问题

const FormatRelated = ({ recommended }) => {
  //  eslint-disable-next-line no-console
  console.log(recommended)
  return (
    <div className="recommendedThumbNailsRow">
      {recommended.map(obj => {
        //  eslint-disable-next-line no-console
        console.log(obj);
        return <DisplayRelatedImg styles={obj} />;
      })}
    </div>
  );
};
const FormatRelated=({推荐的})=>{
//eslint禁用下一行无控制台
console.log(推荐)
返回(
{推荐的.map(obj=>{
//eslint禁用下一行无控制台
控制台日志(obj);
返回;
})}
);
};

映射函数是一个数组函数

如果要循环使用对象道具,应使用以下内容:

Object.keys(recommended).map(key => console.log(recommended[key]))

Edit-im已映射到数组,因为上一个组件中的状态是数组my bad我没有指定我已映射到数组