Reputation: 261
I am trying to set array of object inside async storage but I did not set it . Could someone please help me how to achieve this . Thanks
Code
let joined = this.state.product.concat(product);
this.props.setNotification(joined);
AsyncStorage.setItem("count", joined);
Upvotes: 1
Views: 1158
Reputation: 16334
The easiest way is to stringify the array and store it
AsyncStorage.setItem('count', JSON.stringify(joined));
You will have to parse the string when you retrieve it
const storedArray = await AsyncStorage.getItem('count');
const array = JSON.parse(storedArray)
Upvotes: 1