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

Add support for redux-persist-immutable #77

Open
psx900910 opened this issue Dec 2, 2016 · 0 comments
Open

Add support for redux-persist-immutable #77

psx900910 opened this issue Dec 2, 2016 · 0 comments

Comments

@psx900910
Copy link

In the app/src/state/index.js file Add the following code:
import { createStore, compose, applyMiddleware } from 'redux'; import { fromJS } from 'immutable'; import createSagaMiddleware from 'redux-saga'; import devTools from 'remote-redux-devtools'; import Parse from 'parse/react-native'; import { AsyncStorage } from 'react-native'; import { persistStore, autoRehydrate } from 'redux-persist-immutable'; import createReducer from './reducers'; import sagas from '../sagas'; import Settings from '../settings'; const settings = Settings.load(); Parse.initialize(settings.parseServerApplicationId); Parse.serverURL = settings.parseServerURL; const sagaMiddleware = createSagaMiddleware(); function configureStore(initialState = fromJS({})) { const enhancers = [ autoRehydrate(), applyMiddleware(sagaMiddleware), ]; if (__DEV__) { enhancers.push(devTools()); } const store = createStore(createReducer(), initialState, compose(...enhancers)); sagas.forEach(saga => sagaMiddleware.run(saga)); persistStore(store, { storage: AsyncStorage }); return store; } module.exports = configureStore;

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