在 React Native 中如何在会话中存储值?
In React Native how to Store values in session?
在 React Native 中如何在会话中存储值?
我需要在会话中存储登录详细信息(用户名、密码)。
请您给点意见。
使用AsyncStorage
.
示例:
节省:
AsyncStorage.multiSet([
["email", userInfo.email],
["name", userInfo.name]
])
删除:
let keys = ['email', 'name'];
AsyncStorage.multiRemove(keys, (err) => {
console.log('Local storage user info removed!');
});
获得:
AsyncStorage.multiGet(['email', 'name']).then((data) => {
let email = data[0][1];
let name = data[1][1];
if (email !== null)
//Your logic
});
在 React Native 中如何在会话中存储值?
我需要在会话中存储登录详细信息(用户名、密码)。
请您给点意见。
使用AsyncStorage
.
示例:
节省:
AsyncStorage.multiSet([
["email", userInfo.email],
["name", userInfo.name]
])
删除:
let keys = ['email', 'name'];
AsyncStorage.multiRemove(keys, (err) => {
console.log('Local storage user info removed!');
});
获得:
AsyncStorage.multiGet(['email', 'name']).then((data) => {
let email = data[0][1];
let name = data[1][1];
if (email !== null)
//Your logic
});