在向 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: {...} 是我想要的鍵值對。在底部的這個組件中,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> );};
映射道具時在反應中丟失鍵值對
阿波羅的戰車
2023-04-20 10:48:08