Search code examples
sharedpreferencesreact-native

React Native Async Storage


import AsyncStorage from '@react-native-async-storage/async-storage';

I am using the above package. it was working fine 2 hours ago. but suddenly stop working.no issue or warning is there.

I am using Aysncstorge in my app to save a value. it was working fine. her is my code.

  const Authorize = dispatch => async () =>{
        console.log("calledddd")
            try{
              let islogin = await  AsyncStorage.getItem('islogin')
               console.log(islogin)
            }catch(error){
                console.log(error)
            }
       console.log("called last")
    }

I also tried it like this.

 AsyncStorage.getItem('islogin').then((islogin) => {
     console.log(islogin)
}).catch((error) => {
     console.log(error)
 })

Solution

  • Use it from the following package:

    @react-native-community/async-storage

    Enjoy!!!