I have configured redux-perist in my React.js application like below. While launching application, I am getting below error in console. How to fix it ?
Error: redux-persist failed to create sync storage. falling back to noop storage
import storage from 'redux-persist/lib/storage'
const persistConfig = {
key: 'root',
storage,
}
I have the exact same issue, strangely enough resaving the project does make it suddenly work. Using AsyncStorage from the react native community also doesnt fix it.
Changing redux-persist to version ^5.10.0 does somehow fix this issue.
Same issue even when using Expo 38 and importing from @react-native-community/async-storage. With Expo 38, async storage is now imported from react-native-community instead of react-native, but this doesn't seem to resolve this issue.
Changing redux-persist to version
^5.10.0does somehow fix this issue.
This is the only thing that has worked for me. This seems like a winner for now.
I'm having the same issue with 6.0.0 during SSR in dev mode. Is it possible to disable this warning when typeof window === "undefined"?
I'm having the same issue with
6.0.0during SSR in dev mode. Is it possible to disable this warning whentypeof window === "undefined"?
btw, here is my workaround:
import createWebStorage from "redux-persist/lib/storage/createWebStorage";
const createNoopStorage = () => {
return {
getItem(_key) {
return Promise.resolve(null);
},
setItem(_key, value) {
return Promise.resolve(value);
},
removeItem(_key) {
return Promise.resolve();
},
};
};
const storage =
typeof window === "undefined" ? createNoopStorage() : createWebStorage();
export default storage;
In my case the problem was that I was trying to use the old store in other files that needed to be changed to AsyncStorage
The "noop" storage issue is not solved yet. After a while, uhm, almost half of the year!
Most helpful comment
The "noop" storage issue is not solved yet. After a while, uhm, almost half of the year!