I want to use AsyncStorage.setItem
inside AsyncStorage.getItem
. How to do that in right way?
My code is as follows:
createVehic
Please refer to this official document, it uses getItem
inside setItem
, So I think you could also use setItem
inside getItem
, because the return value is just a Promise
for both getItem
and setItem
.
AsyncStorage.setItem('UID123', JSON.stringify(UID123_object), () => {
AsyncStorage.mergeItem('UID123', JSON.stringify(UID123_delta), () => {
AsyncStorage.getItem('UID123', (err, result) => {
console.log(result);
});
});
});