I have a problem with Redux, where my store is reset to the initial state when I change or reload the current page.
I wan't to add a counter on my site that keep the current number, after changing or reloading the page. I have a "+" and a "-" buttons, that works great, but value is reset to 0 when I reload my page.
components/layout.js :
const initialState = {
count: 0,
}
function reducer(state = initialState, action) {
console.log("reducer", state, action)
switch (action.type) {
//... some actions...
}
}
const store = createStore(reducer)
export default ({ children }) => (
<Provider store={store}>
...
</Provider>
Expected: counter keep the value after reloading page
Actual: counter reset to 0 after reloading page