How to persist the root state?
See original GitHub issueI’m using modules but I also have some root state, so the object I pass to Vuex.Store
looks like this:
{
actions: {}
getters: {}
modules: {user: {…}, course: {…}, courses: {…}}
mutations: {setNavFixed: ƒ, setTheme: ƒ}
plugins: (2) [ƒ, ƒ]
state: {…}
__proto__: Object
}
I want to persist the user
module (which works fine) AND the root state.
The docs don’t mention how to do the latter.
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Persist state with Redux Persist using Redux Toolkit in React
We can customize a part of our state to persist by using the blacklist and whitelist properties of the config object passed to...
Read more >Persist Redux State with redux-persist - DEV Community
We can manually do the state persistent using the native JavaScript localStorage.setItem() method but honestly we will have to write ...
Read more >The Definitive Guide to Redux Persist - React Native Coach
If you are using React, wrap your root component with PersistGate . This delays the rendering of your app's UI until your persisted...
Read more >How to reset the state of a Redux store? - Stack Overflow
First, you need to import the appropriate storage engine and then, to parse the state before setting it to undefined and clean each...
Read more >How to Persist Your Redux Store - How-To Geek
state, ...action}); const persistConfig = { key: "root", storage }; const persistedReducer = persistReducer(persistConfig, reducer); const store ...
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
Sorry, late to the party, but to whoever is visiting this thread now, you can persist the root state by pushing a value of
'/'
to themodules
array, e.g.Thanks!