Open kimgysen opened 5 years ago
Cool project, I'm currently using this for a prototype! Localstorage can be added by :
import { DEFAULT_STORE_NAME, DEFAULT_LOCALSTORAGE_NAME } from 'c/constants' @api localstorgeName = DEFAULT_LOCALSTORAGE_NAME; @api persistedState = localStorage.getItem(DEFAULT_LOCALSTORAGE_NAME) ? JSON.parse(localStorage.getItem(DEFAULT_LOCALSTORAGE_NAME)) : {}; async connectedCallback() { const { storeName, reducers, persistedState, useCombineReducers, useThunk, useLogger, secondary, } = this; const store = createStore(rootReducer, persistedState, enhancer); store.subscribe(()=>{ localStorage.setItem('reduxState', JSON.stringify(store.getState())); });
Although it works, there is this strange issue that localStorage stores the redux state with key '1' intead of the defined DEFAULT_LOCALSTORAGE_NAME. Any idea why is that?
Hello! I am having the same issue, looked around and no answer. By any chance you figure why would the key be replaced by 1 instead of the given name?
Cheers!
Cool project, I'm currently using this for a prototype! Localstorage can be added by :
Although it works, there is this strange issue that localStorage stores the redux state with key '1' intead of the defined DEFAULT_LOCALSTORAGE_NAME.
Any idea why is that?