Usage with redux-persist
See original GitHub issueHow would I use this with redux-persist
?
// routesMap.js
…
WALLET_SELECTOR: {
path: '/wallet-selector/:currency',
thunk: (dispatch, getState) => {
// I don't seem to have the rehydrated state here.
// Is it somehow possible to 'await' rehydration here?
const { steps } = getState()
canContinueIf(steps.currencySelected, dispatch)
}
},
…
Issue Analytics
- State:
- Created 6 years ago
- Comments:18 (10 by maintainers)
Top Results From Across the Web
Persist Redux State with redux-persist - DEV Community
redux -persist provides different storage to persist data like local storage, session storage or async storge. We will use the local storage. We ......
Read more >The Definitive Guide to Redux Persist - React Native Coach
Redux Persist takes your Redux state object and saves it to persisted storage. Then on app launch it retrieves this persisted state and...
Read more >How To Use Redux Persist In React Application
Redux persist takes your Redux state object and save it to Persistence storage. For example, If we store your redux reducers using redux...
Read more >Usage Guide - Redux Toolkit
Usage Guide. The Redux core library is deliberately unopinionated. It lets you decide how you want to handle everything, like store setup, ...
Read more >Why use redux-persist over manually persisting state to ...
Usage of PersistGate which automatically provides a delay in rendering of the components until the state gets persisted along with the usage to ......
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 FreeTop 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
Top GitHub Comments
@faceyspacey I ended up going with the
initialDispatch: false
, I wasn’t aware of this property, so I removed the redux-action-buffer because it’s not needed at all.In case it helps somebody,
persistStore
allows you to add a callback when the re-hydration is complete, so there you can callinitialDispatch()
. There’s as well a gap of a few milliseconds while all of this happens, so I added a spinner so it won’t render a blank screen. I have a page reducer (I took this approach from the official demo) and I set the initial state like this:Not to worry though. Seems like the callback behavior is coming back: https://github.com/rt2zz/redux-persist/issues/408