AsyncStorage:React Native

Lin*_*rin 3 session react-native asyncstorage

将"unique Id"保存为react native中的会话变量

Sya*_*ara 7

您可以使用以下方式添加唯一ID AsyncStorage:

   AsyncStorage.setItem('Key Name', uniqueId)
Run Code Online (Sandbox Code Playgroud)

之后你可以从其他组件中得到这样的:

   AsyncStorage.getItem('Key Name').then((value) => console.log(value))
Run Code Online (Sandbox Code Playgroud)

有关详细信息,请参阅文档.我希望这个答案可以帮到你.