通过 commerceJS API 更新状态时页面变成空白

问题描述 投票:0回答:0

当我尝试通过 API 响应更新状态时,页面变为空白,但状态在后端更新。当我再次刷新页面时,页面显示更新状态。错误在下面提到

enter image description here

如错误所述,购物车未定义。但我从购物车使用状态数组导入购物车。提到的 cart.total_item 是从 response 接收到的数组中的对象名称

enter image description here line_items 是对象名称

我的 App.JS https://github.com/Gopi9655/ECOMMERCE-APP/blob/main/src/App.js

我的购物车.Js https://github.com/Gopi9655/ECOMMERCE-APP/blob/main/src/Components/Cart/Cart.jsx

我的 cartitem.js https://github.com/Gopi9655/ECOMMERCE-APP/tree/main/src/Components/Cart/cartitems

请尽快解决我的问题

reactjs api e-commerce react-state-management
© www.soinside.com 2019 - 2024. All rights reserved.