How can I output that productName inside that return? The items are from the selected cart items. The const order (function) does show in the console, but I can't get it to show inside the return of render.
const mapState = ({ user }) => ({
currentUser: user.currentUser,
});
const mapCartItems = createStructuredSelector({
items: selectCartItems,
});
const CheckingOut = (product) => {
const { total, cartCount, items } = useSelector(mapCartItems);
const order = {
orderItems: items.map((item) => {
const { productName, qty} = item;
return {
productName,
};
console.log(item.productName); // this one is showing in the console
}),
};
return (
<div>
<Container fixed>
<table >
<tr>
<td>Name : </td> // like show the items here
<td></td>
</tr>
<br></br>
<tr>
<td>
<PaymentIcon
style={{ marginRight: "1rem", color: " #e31837" }}
/>
Total Price:
</td>
<td>₱{total}.00</td>
</tr>
</table>
//just other codes for submit
</Container>
</div>
);
};
export default CheckingOut;