In React Native how to Store values in session?
17,093
Use AsyncStorage
.
Example:
For saving:
AsyncStorage.multiSet([
["email", userInfo.email],
["name", userInfo.name]
])
For Deleting:
let keys = ['email', 'name'];
AsyncStorage.multiRemove(keys, (err) => {
console.log('Local storage user info removed!');
});
For Getting:
AsyncStorage.multiGet(['email', 'name']).then((data) => {
let email = data[0][1];
let name = data[1][1];
if (email !== null)
//Your logic
});
Author by
Admin
Updated on June 07, 2022Comments
-
Admin almost 2 years
In React Native how to Store values in session ?
I need to store login details (Username , Password) in session .
Could you Please Give any ideas.
-
Raheel Hasan about 6 years
AsyncStorage
saved data inunencrypted
form and is accessible globally. so Its not the best option to savepassword
-
tradebel123 about 5 years@RaheelHasan can we not encrypt them before storing to AsyncStorage