1

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);

1 Answer 1

1

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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.