reducer is initialized by default parameters before sync with local storage
See original GitHub issueHi guys, when I configure stores app is rendered with initialState after that data will be sync and re-rendered with data from localStorage. Can I initialize store immediately with localStorate instead?
const configureStore = function configureStore(initialState) {
const store = createStore(reducer, initialState, compose(
autoRehydrate(),
applyMiddleware(thunk),
window.devToolsExtension ? window.devToolsExtension() : f => f
));
if (module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers', () => {
const nextReducer = require('../reducers');
store.replaceReducer(nextReducer);
});
}
return store;
};
const store = configureStore({applications, candidates, settings, vacancies});
persistStore(store);
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:13 (3 by maintainers)
Top Results From Across the Web
Where to write to localStorage in a Redux app? - Stack Overflow
If you use combineReducers() you'll notice that reducers that haven't received the state will “boot up” as normal using their default state argument...
Read more >Redux: Persisting the State to the Local Storage - Egghead.io
We will learn how to use store.subscribe() to efficiently persist some of the app's state to localStorage and restore it after a refresh....
Read more >Initializing State | Redux
All reducers are passed undefined on initialization, so they should be written such that when given undefined , some value should be returned....
Read more >How to persist Redux state in local Storage without any ...
Filename: reducer.js This file contains the reducer function. As per the action dispatched through the UI, the corresponding functionality takes ...
Read more >Persisting Redux State to Local Storage | by Jam Creencia
}); });. The saveState function is called inside the store.subscribe listener so it is called every time the storage state changes ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@vdzundza @gausie Did you guys manage to implement it? I’m a little bit lost on how the asyncronous injection of reducers handles the stores
For example, there is recipe “Delay Render Until Rehydration Complete” https://github.com/rt2zz/redux-persist/blob/master/docs/recipes.md#delay-render-until-rehydration-complete