question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

import storage from 'redux-persist/lib/storage' not working

See original GitHub issue

I am using the following: { “native-base”: “^2.13.5”, “react”: “16.8.6”, “react-native”: “0.60.5”, “react-redux”: “^7.1.1”, “redux”: “^4.0.4”, “redux-logger”: “^3.0.6”, “redux-persist”: “^6.0.0”, “redux-thunk”: “^2.3.0”, } , but when importing: import storage from ‘redux-persist/lib/storage’ I get the error “redux-persist failed to create sync storage. falling back to noop storage.”

inquire a bit into your code and observe the following in the file “redux-persist/lib/storage/getStorage.js” in

function hasStorage(storageType) { if ((typeof self === "undefined" ? "undefined" : _typeof(self)) !== 'object' || !(storageType in self)) { return false; } ... } apparently this is true: !(storageType in self), that is storageType is not in self

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

27reactions
hungtn2812commented, Sep 3, 2019

In redux-persist v6, you try changing as follows: import storage from ‘redux-persist/lib/storage’; => import AsyncStorage from ‘@react-native-community/async-storage’;

const persistConfig = { //… storage, } => const persistConfig = { //… storage: AsyncStorage, }

10reactions
todoronecommented, Nov 21, 2019

I also experience the same error with storage: AsyncStorage configuration on redux-persist v6 and RN 0.61.4. @rt2zz What could be the reason?

Read more comments on GitHub >

github_iconTop Results From Across the Web

import storage from 'redux-persist/lib/storage' does not work ...
I get a JS import error saying the module cannot be found: Module not found: Can't resolve 'redux-persist/specific/path/from/above'.
Read more >
Trying to set up this redux-persist in my store.js file but user ...
Trying to set up this redux-persist in my store.js file but user not storing anymore ; "@reduxjs/toolkit"; import ; "redux-persist/es/ ...
Read more >
redux-persist-reborn - npm
Start using redux-persist-reborn in your project by running `npm i ... from 'redux-persist' import storage from 'redux-persist/lib/storage' ...
Read more >
How to use Redux Persist in React Native - LogRocket Blog
In React Native applications, data can be persisted locally using AsyncStorage . AsyncStorage is an asynchronous, persistent, key-value storage ...
Read more >
Top 5 redux-persist Code Examples - Snyk
Use Snyk Code to scan source code in minutes - no build needed - and fix issues ... import storage from 'redux-persist/lib/storage'; import...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found