proshop_django
proshop_django copied to clipboard
Can't get "order._id" in the PlaceOrderScreen.js file
Below is the full error, please help
TypeError: Cannot read properties of undefined (reading '_id') (anonymous function) src/screens/PlaceOrderScreen.js:31 28 | 29 | useEffect(() => { 30 | if (success) {
31 | history.push(/order/${order._id}
)
| ^ 32 | dispatch({ type: ORDER_CREATE_RESET })
33 | }
34 | },[success, history])
View compiled
▶ 22 stack frames were collapsed.
(anonymous function)
src/actions/orderActions.js:42
39 | payload: data
40 | })
41 |
42 | dispatch({
| ^ 43 | type: CART_CLEAR_ITEMS,
44 | payload: data
45 | })
Yes, I used the back-tic character to rap around the statement, so the syntax is all correct, spent many hrs figuring out the issue but so far no luck, please help.
i have problem with order._id too React Hook useEffect has missing dependencies: 'dispatch' and 'order._id'. Either include them or remove the dependency array why is that happened? if orderItem == cartItem it shuld has an _id can you help with fixing this problem?