Persist not working with AsyncStorage (React Native)
See original GitHub issueeasy-peasy: v3.2.0 & v3.3.0 expo: v~36.0.0
When using AsyncStorage, the entire expo app crashes.
Only when passing AsyncStorage to the persist config, like so. Putting ‘localStorage’ does not error.
import { AsyncStorage } from 'react-native';
import { createStore, persist } from 'easy-peasy';
export default createStore(
persist(store, {
storage: AsyncStorage,
}),
);
Maybe down to not stringifying the values: https://stackoverflow.com/questions/49491485/error-react-native-ios-exception-nsdictionarym-length-unrecognised-select
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5
Top Results From Across the Web
Persist not working on React Native · Issue #1253 - GitHub
Hello, I'm using react native version 0.62.0 and redux-persist version 5.10.0. It is not working for me when I enter the app I...
Read more >redux persist not storing store in the async storage
My redux-persist version is 6.0.0. Now I come to my problem. My react-native app is fetching data from json-server and storing it in...
Read more >How To Use Redux Persist in React Native with Asyncstorage
The Redux Persist library provides an easy way to save a Redux store in the local storage of React Native apps. In this...
Read more >React Native Async Storage (persist) Patterns for beginners
Persisting Values in App is a cool not-so-secret. The use cases of AsyncStorage are pretty simple to use. You can set values to...
Read more >redux-persist-reborn - npm
Web: no breaking changes React Native: Users must now explicitly pass their storage engine in. e.g.. import AsyncStorage from '@react-native- ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

solution is to slightly tweak the storage to serialize:
Thanks! I had to add
asyncin front ofsetItemandremoveItemor else I would get an error “Cannot read property ‘catch’ of undefined” from the writeStatedState function of createPersistoid.js in redux-persist.This is what worked for me: