我不知道我为什么用购物车.用户有价值,但当我使用shoppingcart时.用户.id没有价值
useEffect(async () => {
fetchShoppingCart()
}, [])
const fetchShoppingCart = async () => {
const id = props.match.params.id
await getShoppingCartById(id).then(response => {
setShoppingCart(response.data)
}).catch(error => {
alert(error)
})
}
return (
<React.Fragment>
{console.log(shoppingCart.users)}
{console.log(shoppingCart.users.id)}
</React.Fragment>
)
}