Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redux-persist: invalid option passed to persistStore: "transforms" #37

Open
chenyu1990 opened this issue Oct 27, 2018 · 0 comments
Open

Comments

@chenyu1990
Copy link

chenyu1990 commented Oct 27, 2018

console.error: "redux-persist: invalid option passed to persistStore: "transforms". You may be incorrectly passing persistConfig into persistStore, whereas it should be passed into persistReducer."

my code:
`import { createStore } from 'redux';
import { persistStore, persistReducer } from 'redux-persist';
// import { AsyncStorage } from 'react-native';
import storage from 'redux-persist/lib/storage'; // defaults to localStorage for web and AsyncStorage for react-native
import immutableTransform from 'redux-persist-transform-immutable';
import rootReducer from '../reducers/index';
import { Record } from 'immutable';

const persistConfig = {
transforms: [immutableTransform()],
key: 'root',
storage,
blacklist: ['navigation'],
};

const persistedReducer = persistReducer(persistConfig, rootReducer);
const recordUserCenter = Record({
uid: 0,
email: '',
username: '',
password: '',
error: '',
token: '',
}, 'userCenter');

export default () => {
let store = createStore(persistedReducer);
let persistor = persistStore(store, {
transforms: [immutableTransform({
records: [recordUserCenter],
whitelist: ['friends'],
})]
});
return { store, persistor }
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant