Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Workaround for promise issues with AsyncStorage multiSet/multiGet/multiRemove in React Native (unresolved as of 2018-07-02). See: https://github.com/facebook/react-native/issues/14101
export default class AsyncStorageSupplement {
static multiGet(keys) {
return Promise.all(
keys.map(key => AsyncStorage.getItem(key))
)
}
static multiRemove(keys) {
return Promise.all(
keys.map(key => AsyncStorage.removeItem(key))
)
}
static multiSet(pairs) {
return Promise.all(
pairs.map(pair => AsyncStorage.setItem(pair[0], pair[1]))
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.