How to use the redux-localstorage-simple.load function in redux-localstorage-simple

To help you get started, we’ve selected a few redux-localstorage-simple examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github studiometa / react-next-starter / store / createStore.js View on Github external
export default (initialState = DEFAULT_STATE) => {
  // We do not want middlewares like redux-logger to get
  // fired on the server side

  if (isServer) {
    return createStore(reducers, initialState, applyMiddleware(thunk.withExtraArgument(socket)));
  } else {
    initialState = deepmerge(
      load({ states: localStorageStates, namespace: packageJson.name }),
      initialState,
    );
    return createStore(
      reducers,
      initialState,
      applyMiddleware(logger,
        save({ states: localStorageStates, namespace: packageJson.name }),
        thunk.withExtraArgument(socket)),
    );
  }

};
github joshwcomeau / tinkersynth / src / store / configure-store.prod.js View on Github external
export default function configureStore() {
  // In SSR, we can't access localStorage, so we need to build the store without
  // save/load support. I think this is fine though.
  let store;

  if (typeof window === 'undefined') {
    store = createStore(rootReducer);
  } else {
    store = createStore(
      rootReducer,
      load(reduxLocalStorageConfig),
      applyMiddleware(save(reduxLocalStorageConfig))
    );
  }

  return store;
}
github joshwcomeau / tinkersynth / src / store / configure-store.dev.js View on Github external
export default function configureStore() {
  const store = createStore(
    rootReducer,
    load(reduxLocalStorageConfig),
    compose(
      applyMiddleware(focusManagerMiddleware, save(reduxLocalStorageConfig)),
      DevTools.instrument()
    )
  );

  // Allow direct access to the store, for debugging/testing
  window.store = store;

  return store;
}
github Yoast / YoastSEO.js / examples / webpack / src / redux / utils / localstorage.js View on Github external
export function getStorageData( states = [], preloadedState = {} ) {
	return load( {
		states,
		namespace,
		preloadedState,
		disableWarnings: true,
	} );
}
github benhowdle89 / filtergram / client / src / etc / configure-store.js View on Github external
const composeEnhancers =
    (window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;
  const middleware = [
    thunkMiddleware,
    save({
      namespace: APP_LS_KEY,
      states: storageStates
    }),
    !PRODUCTION && loggerMiddleware
  ].filter(Boolean);

  const enhancer = composeEnhancers(applyMiddleware(...middleware));

  const store = createStore(
    rootReducer,
    load({
      namespace: APP_LS_KEY,
      states: storageStates,
      preloadedState: {
        auth: { ...initialAuthState },
        profiles: { ...initialProfilesState },
        favourites: { ...initialFavouritesState }
      },
      disableWarnings: true
    }),
    enhancer
  );

  return store;
};
github danielrob / aperitif-editor / src / configureStore.js View on Github external
export default function configureStore(history) {
  const middleware = applyMiddleware(routerMiddleware(history), spyMiddleware, save)
  const enhancer = composeEnhancers(middleware)

  return createStore(
    combineReducers({
      app: appReducer,
      router: routerReducer,
    }),
    makeLoader(),
    enhancer,
  )
}

redux-localstorage-simple

Save and load Redux state to and from LocalStorage.

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis