0

I am trying to use async storage with "react native web" but it is saying " AsyncStorage is null".

commands I ran:

yarn add @react-native-community/async-storage

react-native link @react-native-community/async-storage

When I try to open localhost:3000, it says that error.

Any idea how to fix this?

7
  • Where does it say, asyncstorage is null? How do you improve and use it? We need a little bit more information to help you. Commented Aug 5, 2019 at 11:16
  • When I try to open localhost:3000, I got that error. I tried to fix by running link command but didnt work. Commented Aug 5, 2019 at 11:17
  • Show some code how you use it. Commented Aug 5, 2019 at 11:20
  • I only imported it because I am testing app without asyncstorage. So only one import -- import AsyncStorage from '@react-native-community/async-storage'; Commented Aug 5, 2019 at 11:21
  • what is your react-native version? Commented Aug 5, 2019 at 14:37

1 Answer 1

1

I think one thing you can do is use @callstack/async-storage module.

import AsyncStorage from '@callstack/async-storage';

According to their github repo, you can use it on web and mobile and works excellent with redux-persist.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.