【发布时间】:2021-09-12 04:33:17
【问题描述】:
我可以有两个 AsynStorage 实例吗?我知道当你设置一个项目时,你可以例如对一个数组进行字符串化并有类似的东西:
AsyncStorage.setItem( 'names' , '[John, Carl, Sam]' );
因为我知道您不能将对象或数组保存为 AsyncStorage 中的值。那么有没有办法让多个实例拥有这样的东西:
Instance 1 AsyncStorage:
-["a","aaa"]
-["b","bbb"]
-["c","ccc"]
Instance 2 AsyncStorage:
-["d","ddd"]
-["e","eee"]
-["f","fff"]
并调用例如 Instance2AsyncStorage.getItem("d") ,如果我想要实例 1 中的某些内容,我会执行 Instance1AsyncStorage.getItem("a")?
【问题讨论】: