const addqtyHandler = async id => {
let itemArray = await AsyncStorage.getItem('cartItems');
itemArray = JSON.parse(itemArray);
console.info(itemArray);
console.info(id);
if (itemArray) {
let array = itemArray;
for (let index = 0; index < array.length; index++) {
if (array[index] == id) {
console.info(array[index]);
let qty = Items[index].quantity;
itemArray = qty + 1;
console.log(itemArray);
}
}
try {
await AsyncStorage.setItem('cartItems', JSON.stringify(itemArray));
await AsyncStorage.mergeItem('cartItems',JSON.stringify(itemArray));
getDataFromDB();
}
catch (error) {
return (error);
}
}
}
How to add the quantity of my cart and update it in async storage i dont know how to update my quantity of my cart, i have been searching how to do it, i try to do many things