How to use the @react-native-community/async-storage.default.getItem function in @react-native-community/async-storage

To help you get started, we’ve selected a few @react-native-community/async-storage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stockulus / react-native-unique-id / index.js View on Github external
return polygoat(done => {
    if (id) return done(null, id)

    AsyncStorage.getItem('__uniqueId', (error, data) => {
      if (error || !data) {
        const generatedId = generate()

        AsyncStorage.setItem('__uniqueId', generatedId, error => {
          if (error) return done(error)
          id = generatedId
          done(null, id)
        })
      } else {
        id = data
        done(null, id)
      }
    })
  }, callback)
}