我试图在异步存储中设置对象数组,但我没有设置它。有人可以帮助我如何实现这一目标。谢谢
代码
let joined = this.state.product.concat(product);
this.props.setNotification(joined);
AsyncStorage.setItem("count", joined);
最简单的方法是将数组字符串化并存储
AsyncStorage.setItem('count', JSON.stringify(joined));
检索字符串时必须对其进行解析
const storedArray = await AsyncStorage.getItem('count');
const array = JSON.parse(storedArray)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句