1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

AsyncStorageを使用中にはまったエラー

Last updated at Posted at 2021-02-06

react-nativeでAsyncStorageを使用してデータを永続化しようとしたときに下記のようなエラーが出てきた時のエラー解消です

[Unhandled promise rejection: TypeError: undefined is not an object
 (evaluating '_asyncStorage.AsyncStorage.setItem')]

上記のエラーが出ている時はインポート文を

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

から

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

に変更するとエラーが解消されます

この些細なミスで消耗する人が1人でも減りますように、、

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?