redux-persist failed to create sync storage. falling back to noop storage.

28
0
redux-persist failed to create sync storage. falling back to noop storage.

Remove this code:

import storage from "redux-persist/lib/storage";

Add this code:

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"
    ? createWebStorage("local")
    : createNoopStorage();

Leave a Reply

Your email address will not be published.