elgerlambert / redux-localstorage

Store enhancer that syncs (a subset) of your Redux store state to localstorage.
MIT License
1.32k stars 107 forks source link

example for config.slicer #75

Closed themojilla closed 3 years ago

themojilla commented 7 years ago

Hi and thanks for your great repo My state looks like below

{
  promotionPage: {},
  listPage: {
    products: {}
    compareList: {}
  }
  ...
}

Could you please give an example how to include "compareList" piece in persistState method Thanks a lot.

themojilla commented 7 years ago

Solve the problem

persistState(null, {
        slicer: (paths) => (state) => {
            return {compareList: state['listPage']['compareList']}
        }
    })

but now the problem is when i refresh the page the localstorage key will be empty

{"compareList":{}}