user2349115
user2349115

Reputation: 1286

AsyncStorage is null when using with react native web

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?

Upvotes: 0

Views: 1322

Answers (1)

Jeremiah
Jeremiah

Reputation: 358

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.

Upvotes: 1

Related Questions