redux-persist v: 5.9.1
react-native v: 0.52.2
react v: 16.2
redux v: 3.7.2
Using with react-native, when app boots this error occurs
@sadi304 How did you solve the problem? I'm facing the same issue....
there was a problem in the structure. I actually forgot what the issue was. but it was not a bug definitely. the problem was from my side.
oh i remembered. the objects were not exported correctly. persist store and the store.
Thanks for the quick reply, you where right about the objects, all working now
I have the same issue, please support me resolve issue,
This is my store.js file:
const persistConfig = {
key: 'root',
storage,
};
const persistedReducer = persistReducer(persistConfig, rootReducer);
const store = createStore(
persistedReducer,
applyMiddleware(thunkMiddleware, axiosMiddleware(baseUrl), logger),
);
const persistor = persistStore(store);
export default { store, persistor };
@anhphuongbn94 what do your app and reducer files look like? might be importing the store and persistor wrong?
@anhphuongbn94 https://github.com/anhphuongbn94 my problem was in the
import, your store file looks fine
On 1 March 2018 at 21:54, Brian Zhang notifications@github.com wrote:
@anhphuongbn94 https://github.com/anhphuongbn94 what do your app and
reducer files look like? might be importing the store and persistor wrong?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/rt2zz/redux-persist/issues/734#issuecomment-369744279,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AKv12yXs43GMnDSCeCBuhLbWmr9OBdVqks5taG4qgaJpZM4SR1eD
.
@anhphuongbn94 , look at your codes, how you are exportng or importing. the problem is there. as persistor was undefined .
Thanks and sorry reply late, This is my file config redux:
de structure your import . use { }
you mean: import {store, persistor} from './redux/store';
i tried but store is undefined
@anhphuongbn94 import {store, persistor} from 'your-store-module' is definitely the right import syntax. I would double check your export statements and paths.
import {store, persistor} from 'your-store-module' didn't work for me,
I used import Store from 'your-store-module'
and then used: Store.store and Store.persistor
On 2 March 2018 at 18:17, Zack Story notifications@github.com wrote:
@anhphuongbn94 https://github.com/anhphuongbn94 import {store,
persistor} from 'your-store-module' is definitely the right import
syntax. I would double check your export statements and paths.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/rt2zz/redux-persist/issues/734#issuecomment-370005918,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AKv129tNSgHK_wlroTaPyW3A6648FV27ks5taYzUgaJpZM4SR1eD
.
@rt2zz thank for your help
@tomelsner I changed the code as you said and resolve issue but i don't understand why resolve issue, you can explain me.
Thanks.
default should be ommited for that case
when you export default you cant destructure . you have to import as a default
I understand, thank for your help 👍
@anhphuongbn94 pls can u show me how you did? Have the same problem; but not working
in configureStore I have
.....
let store = createStore(persistedReducer);
let persistor = persistStore(store);
export default { store, persistor };
and i call it in app.js
import { store, persistor } from "./store/configureStore";
<Provider store={store}>
<PersistGate loading={null} persistor={store.persistor}>
import MS from .......
MS.store
MS.persistor
PS: please use stack overflow for these questions. report bugs or feature requests here . this is a closed topic already.
@jpainam you need change:
import Store from "./store/configureStore";
use Store.store, Store.persistor
you can log store for better understanding.
It's working fine in React Native App.But i used it for reactjs. I am getting this issue now.I imported correctly.Please tell me what should i do in my case..
I recently fixed the same problem. I was wrong exporting my store and my persistor, like @anhphuongbn94 in his store/index.js, i used "export default {store, persistor}" instead just "export {store, persistor}"
Most helpful comment
import {store, persistor} from 'your-store-module' didn't work for me,
I used import Store from 'your-store-module'
and then used: Store.store and Store.persistor
On 2 March 2018 at 18:17, Zack Story notifications@github.com wrote: