Skip to content

Instantly share code, notes, and snippets.

@rt2zz
Created April 3, 2016 18:36
Show Gist options
  • Save rt2zz/9cdff520e3a65eea846826908028c65b to your computer and use it in GitHub Desktop.
Save rt2zz/9cdff520e3a65eea846826908028c65b to your computer and use it in GitHub Desktop.
import {getStoredState, createPersistor, autoRehydrate } from 'redux-persist'
export async function bootstrap () {
let initialState
try {
initialState = await getStoredState()
} catch (err) {
initialState = {}
}
const store = finalCreateStore(reducer, initialState)
createPersistor(store)
return store
}
import {getStoredState, createPersistor, autoRehydrate } from 'redux-persist'
export function bootstrap (cb) {
getStoredState(null, (err, initialState) => {
const store = finalCreateStore(reducer, initialState)
const persistor = createPersistor(store)
cb(store)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment