How to use the redux-persist.persistCombineReducers.bind function in redux-persist

To help you get started, we’ve selected a few redux-persist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rematch / rematch / plugins / persist / src / index.ts View on Github external
const persistPlugin = (
	persistConfig = {},
	persistStoreConfig,
	callback
): Plugin => {
	// merge config with common config options
	const mergedConfig = {
		key: 'root',
		storage,
		...persistConfig,
	}
	return {
		config: {
			// pass in merged config as first param of persistCombineReducers
			redux: {
				combineReducers: persistCombineReducers.bind(null, mergedConfig),
			},
		},
		onStoreCreated(store) {
			// run persist store once store is available
			persistor = persistStore(store, persistStoreConfig, callback)
		},
	}
}
github mickeyjsx / mickey / examples / counter-persist(v5)-immutable / src / index.jsx View on Github external
['count']
);

const persistConfig = {
  transforms: [saveSubsetFilter, immutableTransform()],
  keyPrefix: 'mickey-immutable:',
  storage,
  whitelist: ['counter'],
  key: 'primary',
  stateReconciler: autoMergeImmutable // rehydrate immutable state
}
// 1. Initialize
const app = createApp({
  initialState: {}, //must be a no-immutable object
  extensions: {
    combineReducers: MickeyPersist(persistCombineReducers.bind(this, persistConfig), combineReducers),
  },
})

// 2. Model
app.model(require('./models/counter.js'))
// 3. View
app.render(null, document.getElementById('root'), {
  beforeRender: ({ store }) => new Promise(((resolve) => {
    resolve(
              
            ); 
  })),
})
github mickeyjsx / mickey / examples / counter-persist(v5) / src / index.jsx View on Github external
const saveSubsetFilter = createFilter(
  'counter',
  ['count']
);

const persistConfig = {
  transforms: [saveSubsetFilter],
  keyPrefix: 'mickey:',
  storage,
  whitelist: ['counter'],
  key: 'primary'
}
// 1. Initialize
const app = createApp({
  extensions: {
    combineReducers: MickeyPersist( persistCombineReducers.bind(this, persistConfig) ),
  }
})


// 2. Model
app.model(require('./models/counter.js'))
// 3. View
app.render(null, document.getElementById('root'), {
  beforeRender: ({ store }) => new Promise(((resolve) => {
    resolve(
      
    );
  })),
})